Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Calculate the percentage of a group value from a total sum
Go
New
Search
Notify
Tools
Reply
  
Calculate the percentage of a group value from a total sum
 Login/Join
 
Member
posted
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

..Field_A......Field_B....Field_C
Sub-Total........10.........500
%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
Alfred
 
Posts: 12 | Location: Linz, Austria | Registered: February 03, 2004Reply With QuoteReport This Post
Platinum Member
posted Hide Post
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;
END

you can then use this new field for your calculation instead.
 
Posts: 123 | Location: UK | Registered: October 09, 2003Reply With QuoteReport This Post
Gold member
posted Hide Post
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
BY BODYTYPE
WHERE TOTAL BODYTYPE EQ 'SEDAN'
END
 
Posts: 60 | Location: 2 penn | Registered: May 22, 2003Reply With QuoteReport This Post
Member
posted Hide Post
Thank you to both,
I made it with the criteria in the define section.

Alfred
 
Posts: 12 | Location: Linz, Austria | Registered: February 03, 2004Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Calculate the percentage of a group value from a total sum

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.