Focal Point
[SOLVED] How can recalculate the percentages on the COLUMN Totals?

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

August 02, 2010, 05:36 PM
fvillasa
[SOLVED] How can recalculate the percentages on the COLUMN Totals?
Hi everybody. I'm creating a report with the percentages of the car sales by country, and I have two across dimensions: seats and body type. The column totals should be 100% for all the columns, and the across total must be recalculated with the percentages of the sales of the country over the total of the sales of the cars of the specific seats quantity. Now, the report is aggregating the percentages of the country, and it's displaying values greater than 100% on the across totals. How can I recalculate the percentages on the COLUMN-TOTALS? May you help me with that?

TABLE FILE CAR
SUM
'PCT.CAR.BODY.SALES/D7.2%' AS '%'
BY 'CAR.ORIGIN.COUNTRY'
ACROSS 'CAR.BODY.SEATS' AS ''
ACROSS 'CAR.BODY.BODYTYPE' AS '' ACROSS-TOTAL
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *

Thanks.

Regards, Francisco.

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


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)
August 02, 2010, 06:28 PM
Dan Satchell
ACROSS-TOTAL only performs summing, but you need a RECOMPUTE to recalculate the ACROSS percentages. Unfortunately, RECOMPUTE does not work on prefix operators like PCT (at least not with ACROSS), so you must COMPUTE the percentages in order for RECOMPUTE to work. See if the code below produces the desired results.

TABLE FILE CAR
 SUM
  COMPUTE PCT_SALES/D7.2% = SALES / TOT.SALES * 100 ; AS '%'
 BY COUNTRY
 ACROSS SEATS AS ''
 ACROSS BODYTYPE AS '' RECOMPUTE AS 'TOTAL'
 HEADING
  ""
 FOOTING
  ""
 ON TABLE SET PAGE-NUM OFF 
 ON TABLE COLUMN-TOTAL AS 'TOTAL'
END



WebFOCUS 7.7.05
August 03, 2010, 02:20 PM
fvillasa
Yes! It worked. Thank you so much for your help.

Regards.


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)
August 11, 2010, 06:58 PM
fvillasa
I think that the Stack Measure option could solve my problem. I have been trying it and it seems that it does the functionality that I was searching.

Thanks.

Regards, Francisco.


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)