Focal Point
[SOLVED] ROW-TOTAL doesn't RECOMPUTE with ACROSS

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2577043436

October 25, 2013, 03:32 PM
MartinY
[SOLVED] ROW-TOTAL doesn't RECOMPUTE with ACROSS
Hi,

I have the following and I want the Grand Total also process the proper recompute for the "OT Hours %" which is not actually. It just summarize the percentage.
Any ideas ?

TABLE FILE CAR
SUM SALES AS 'Reg Hrs'
DEALER_COST AS 'Reg Pay'
COMPUTE OT_Hours /D10.2%=(SALES/DEALER_COST)/ 100; AS 'OT Hours %'
BY COUNTRY
ACROSS CAR ACROSS-TOTAL AS 'ACROSS TOT' RECOMPUTE
ON TABLE ROW-TOTAL AS 'GRAND TOTAL' RECOMPUTE
END

Thanks

This message has been edited. Last edited by: MartinY,


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
October 25, 2013, 04:01 PM
David Briars
It sounds like you would like another set of the Hrs, Pay, and OT Hours columns to appear at the end of your report, with the same values as you obtained with the ACROSS-TOTAL on CAR.

Below I commented out your ROW-TOTAL, and added another ACROSS command, that seems to give the 2nd set of total columns at the end of the report.

DEFINE FILE CAR
 GRAND/A1 = ' ';
END
TABLE FILE CAR
SUM     SALES       AS 'Reg Hrs'
        DEALER_COST AS 'Reg Pay'
COMPUTE OT_Hours /D10.2%=(SALES/DEALER_COST)/ 100; AS 'OT Hours %' 
BY      COUNTRY
ACROSS  GRAND ACROSS-TOTAL AS 'ACROSS TOT 2' RECOMPUTE 
ACROSS  CAR   ACROSS-TOTAL AS 'ACROSS TOT 1' RECOMPUTE
-*ON TABLE ROW-TOTAL AS 'GRAND TOTAL' RECOMPUTE
END
-EXIT 





Pilot: WebFOCUS 8.2.06 Test: WebFOCUS 8.1.05M Prod: WebFOCUS 8.1.05M Server: Windows Server 2016/Tomcat Standalone Workstation: Windows 10/IE11+Edge Database: Oracle 12c, Netezza, & MS SQL Server 2019 Output: AHTML/XLSX/HTML/PDF/JSCHART Tools: WFDS, Repository Content, BI Portal Designer & ReportCaster
October 28, 2013, 07:20 AM
MartinY
Hi David,
Not exactly. I don't want the same values displayed. I want a sub-total of the across and a grand total of the row (the BY).
But the thing is when I have a COMPUTE in the SUM fields, it's summarized and not recomputed in the grand total.

Look in that example where the grand total PCT of Biscotti should be 8% and not 24.18% which is the sum of 7.81% + 8.53% + 7.84%.

TABLE FILE GGSALES
SUM UNITS
DOLLARS
COMPUTE PCT/D6.2% = UNITS/DOLLARS * 100; AS 'PCT'
BY PRODUCT
ACROSS ST
ACROSS STCD ACROSS-TOTAL AS 'STATE TOTAL' RECOMPUTE
WHERE ST EQ 'CA' OR 'CT';
ON TABLE ROW-TOTAL AS 'GRAND TOTAL' RECOMPUTE
END
-RUN

Regards,


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
October 28, 2013, 08:08 AM
Danny-SRL
Martin,

How about:
  
TABLE FILE GGSALES
SUM UNITS
DOLLARS
COMPUTE PCT/D6.2% = UNITS/DOLLARS * 100; AS 'PCT'
BY PRODUCT 
ACROSS ST ACROSS-TOTAL AS 'GRAND TOTAL' RECOMPUTE
ACROSS STCD ACROSS-TOTAL AS 'STATE TOTAL' RECOMPUTE
ON TABLE SUMMARIZE
WHERE ST EQ 'CA' OR 'CT';
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

October 29, 2013, 10:03 AM
MartinY
Hi,

I finally make it run and my problem was a little more complex than I thought.

Your code was good Danny, but if you add another ACROSS ST NOPRINT as the first ACROSS, the total is not shown at the right place.

I found that my issue was that: I have another ACROSS MONTH_D NOPRINT prior an ACROSS MONTH_X because I want it ordered by the month number and not by the description of the month. I want: JAN, FEB, MAR, APR instead of APR, FEB, JAN, MAR which it be if it's only ordered by the month description.

So I had to play a little bit with the order of the ACROSS and ACROSS-TOTAL to make it run but it does now.

Thanks to both of you

Below illustration of what I'm saying above. I know that displaying ST_D is not really relevant, but if you want the "Product Total" title displayed, you don't have choice. And in my case, it's for month display, so having the number and the description it's ok.

DEFINE FILE GGSALES
ST_D /D1 = DECODE ST ('CA' 2 'CT' 1);
END

-* "Product Total" Not properly displayed
TABLE FILE GGSALES
SUM UNITS
DOLLARS
COMPUTE PCT/D6.2% = UNITS/DOLLARS * 100; AS 'PCT'
BY PRODUCT

ACROSS ST_D NOPRINT
ACROSS ST AS 'State'
ACROSS-TOTAL AS 'Product Total' RECOMPUTE

ACROSS STCD AS 'Store'
ACROSS-TOTAL AS 'State Total' RECOMPUTE
WHERE ST EQ 'CA' OR 'CT';
ON TABLE COLUMN-TOTAL RECOMPUTE
END
-EXIT

-* "Product Total" Properly displayed with title
TABLE FILE GGSALES
SUM UNITS
DOLLARS
COMPUTE PCT/D6.2% = UNITS/DOLLARS * 100; AS 'PCT'
BY PRODUCT

ACROSS ST_D AS 'State'
ACROSS-TOTAL AS 'Product Total' RECOMPUTE
ACROSS ST AS ''

ACROSS STCD AS 'Store'
ACROSS-TOTAL AS 'State Total' RECOMPUTE
WHERE ST EQ 'CA' OR 'CT';
ON TABLE COLUMN-TOTAL RECOMPUTE
END
-EXIT


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
October 29, 2013, 01:49 PM
Danny-SRL
Martin

You can use the following:
  
TABLE FILE GGSALES
SUM UNITS
DOLLARS
COMPUTE PCT/D6.2% = UNITS/DOLLARS * 100; AS 'PCT'
BY PRODUCT 

ACROSS ST AS 'State' COLUMNS CT AND CA
ACROSS-TOTAL AS 'Product Total' RECOMPUTE

ACROSS STCD AS 'Store'
ACROSS-TOTAL AS 'State Total' RECOMPUTE
WHERE ST EQ 'CA' OR 'CT';
ON TABLE COLUMN-TOTAL RECOMPUTE
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF