Focal Point
[SOLVED] How to calculate a cumulative percent?

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

April 13, 2011, 02:17 PM
Carlos Dias
[SOLVED] How to calculate a cumulative percent?
Hello,
I need to create a graph with a cumulative percent.
Based on what I read here http://wiki.answers.com/Q/How_..._cumulative_percent, I can create a temporary file that gives me the individual values and the percent.
But how can I add the percent value of the step before?

Thanks in advanced,
Carlos Dias

This message has been edited. Last edited by: Carlos Dias,


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
April 14, 2011, 02:14 AM
Dave
You can not.
That would be mathematically incorrect.

But you can:
TABLE FILE CAR
	SUM SALES DCOST
	COMPUTE PERC/D12.2% = ( DCOST / SALES ) * 100;
	COMPUTE CUME_SALES/D12 = CUME_SALES + SALES; NOPRINT
	COMPUTE CUME_DCOST/D12 = CUME_DCOST + DCOST; NOPRINT
	COMPUTE CUME_PERC/D12.2% = ( CUME_DCOST / CUME_SALES ) * 100;
BY CAR
END


So first make a CUME_ of the two components you need in you percentage.
Then calculate the cumulative percentages.

G'luck.
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
April 14, 2011, 06:01 AM
FrankDutch
you can

just ad an extra compute

CUMUL_PCT=LAST CUMU_PCT+ PCT;




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

April 16, 2011, 06:24 AM
Carlos Dias
The solution posted by Dave solve my problem.

Thanks,
Carlos Dias


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
February 27, 2012, 08:41 PM
CathyB
Hi,

I found this great solution to my problem that Dave posted of running a cumulative column. However, the problem I have is that my report is BY Vendor So I will have several rows of records by Vendor and then the Vendor# changes and several more rows of records for that vendor, I need the Cumulative column to recalculate every time the The Vendor Number changes.

Vendor InvoiceAmt CumulativeAmt
ABC 100 100
ABC 200 300

XYZ 50 50
XYZ 200 250


I appreciate any help. Thanks.


WEBFOCUS 7.14
WEBFOCUS.8.04
February 28, 2012, 02:58 AM
Dave
Only logical for me to answer this :-)

TABLE FILE yourfile
SUM InvoiceAmt
    COMPUTE CumulativeAmt/D12 = IF LAST FST.Vendor EQ FST.Vendor THEN CumulativeAmt + InvoiceAmt ELSE InvoiceAmt;
BY Vender
END


You just have to make the Cumulative column smarter. It now checks wheter the Vendor of the LAST row of the internal matrix is the same as te one on the current row.
In your case you don't need the FST. because Vendor is alphanumeric. If Vendor is a number you will need to use FST. Because otherwise SUM Vendor will sum the Vendornumber and you won't be able to do the check.

G'luck,
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
February 28, 2012, 08:26 AM
CathyB
Worked perfectlySmiler Thanks so much Dave!


WEBFOCUS 7.14
WEBFOCUS.8.04