Focal Point
[SOLVED] Get PCT Based on BY

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

July 27, 2009, 02:34 PM
jammer
[SOLVED] Get PCT Based on BY
I would like to get pct of total like this

group amt PCT
A $50 50%
A $50 50%
TOTAL A $100 100%
B $25 25%
B $75 75%
TOTAL B $100 100%

When I do this

TABLE FILE filename
SUM
AMT
PCT.AMT/D20.4 AS 'AMT'
BY GROUP

I get

group amt PCT
A $50 25%
A $50 25.6%
TOTAL A $100 50%
B $25 12.5%
B $75 37.5%
TOTAL B $100 50%

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


Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat
July 27, 2009, 02:48 PM
Danny-SRL
Jammer,

If you have
  
group    amt PCT
A        $50 25%
A        $50 25.6%
TOTAL A $100 50%
B        $25 12.5%
B        $75 37.5%
TOTAL B $100 50%

then, you are sorting on more than group.

Now if you want 100% for each group then you have to use the WITHIN clause with PCT:
  
TABLE FILE filename
SUM
AMT
PCT.AMT/D20.4 AS 'AMT' WITHIN GROUP
BY GROUP



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

July 27, 2009, 04:45 PM
jammer
Thanks - that was easy - I just could not find it!


Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat