How can I compute the percentage of a group value from the hole dataset when the fex has a where condition and not showing the hole data. Maybe I have to execute an extra fex before which calculates the sum of all values an pass the result to a variable. As well how can I put the results in an extra line before the sub-total
%of Total........10%........50%..wanted Result
fex with "where (Field A EQ yyy);"
Total of the hole dataset is Field B = 100 and Field C = 1000
Can somebody help me, thanks
Simple answer is you can't unless you do one of the following.
Either create a holdfile with the total values in it, and join that hold file to your holdfile with the data extracted using your WHERE statement and then calculate your percentage.
Or remove your WHERE criteria and put them in a define. E.g.
DEFINE FILE filename
FIELDA/I5=IF FIELDA EQ 'xyz' THEN FIELDA ELSE 0;
you can then use this new field for your calculation instead.
Never say never. <grin> Let everything into the report,and then eliminate by WHERE TOTAL. In my case, I'm using CAR, and only BODYTYPE = sedan is to show on the report:
TABLE FILE CAR
SUM PCT.SALES NOPRINT PCT.RCOST NOPRINT
PCT.DCOST NOPRINT BY BODYTYPE
ON BODYTYPE SUBFOOT
"TOTAL <ST.SALES> <ST.RCOST> <ST.DCOST>"
"PCT <PCT.SALES> <PCT.RCOST> <PCT.DCOST></1"
PRINT SALES RCOST DCOST BODYTYPE NOPRINT
WHERE TOTAL BODYTYPE EQ 'SEDAN'
Thank you to both,
I made it with the criteria in the define section.
|Powered by Social Strata|