[CLOSED] Calculate Percent at the Total/Subtotal level
If you run this code all the percentages get calculated and recalculated correctly except for the per cent total at the total country level. (percent to total = 2/18 and percent to country = 2/4 for example for the Jaguar.) You can see total count gets to be zero at the 'Total Country England' level. The percentage should be recalculated as 4/18 = 22.2%. Any ideas on how to do that are appreciated.
TABLE FILE CAR
SUM CNT.BODYTYPE
SUM
CNT.BODYTYPE
BY COUNTRY
SUM
CNT.BODYTYPE
BY COUNTRY
BY CAR
SUM
COMPUTE C1/D12 = C1; AS 'TOTAL'
COMPUTE C2/D12 = C2; AS 'TOTCNTRY'
COMPUTE C3/D12 = C3; AS 'TOTCAR'
COMPUTE PCT_TOTAL/D12.2% = C3/C1 * 100;
COMPUTE PCT_CNTRY/D12.2% = C3/C2 * 100;
BY COUNTRY
BY CAR SUMMARIZE MULTILINES
END
This message has been edited. Last edited by: Kerry,
Reporting Server 7.6.10 Dev. Studio 7.6.8 Windows NT Excel, HTML, PDF
October 09, 2009, 03:54 PM
mrguru
use recompute not summarize
WF 8.2.01M 8.2.01M Reporting Server Windows 2012 Srvr R2 PDF,Excel, HTML Graphs - a lot of graphs
October 09, 2009, 04:23 PM
Rick Man
With MULTILINES there is no summary by Country, without I get a summary line per car but all 0%
Reporting Server 7.6.10 Dev. Studio 7.6.8 Windows NT Excel, HTML, PDF
October 15, 2009, 03:53 PM
Kerry
Hi Rick,
You may want to try the following code:
TABLE FILE CAR
SUM
CNT.BODYTYPE WITHIN TABLE NOPRINT
CNT.BODYTYPE WITHIN COUNTRY NOPRINT
CNT.BODYTYPE WITHIN CAR NOPRINT
CNT.COUNTRY WITHIN CAR NOPRINT
COMPUTE TOT1/D12 = C1/C4; AS 'TOTAL '
COMPUTE TOT2/D12 = C2/C4; AS 'TOTCNTRY '
COMPUTE TOT3/D12 = C3/C4; AS 'TOTCAR '
COMPUTE PCT_TOTAL/D12.2% = TOT2/TOT1 * 100;
COMPUTE PCT_CNTRY/D12.2% = TOT3/TOT2 * 100;
BY COUNTRY
BY CAR SUMMARIZE MULTILINES
ON TABLE SET STYLE *
GRID=OFF,$
END
Cheers,
Kerry
Kerry Zhan Focal Point Moderator Information Builders, Inc.