I need to get a report for each state and year, their % of sales (which means {Sales of Alabama for 2009/Total sales of all states for 2009}*100). I am able to get it for one year but for multiple years, values go wrong.
Can some one help me out here.
ThanksThis message has been edited. Last edited by: Kerry,
8.1.05 HTML,PDF,EXL2K, Active, All
April 25, 2011, 03:31 PM
<JG>
quote:
Can some one help me out here.
Yes, 2,000 $ per day or part of.
April 25, 2011, 04:40 PM
jimbo
I'm pretty sure this will work for you
TABLE FILE CENTURYSALES
SUM QUANTITY AS 'YR_QUANTITY'
BY YEAR
SUM QUANTITY
BY YEAR
BY STORECODE
ON TABLE SET ASNAMES ON
ON TABLE HOLD
END
TABLE FILE HOLD
SUM QUANTITY
COMPUTE
PCT_TOTAL/D8.2% = (QUANTITY / YR_QUANTITY) * 100 ;
BY STORECODE RECOMPUTE MULTILINES AS ' '
BY YEAR
END
this is awesome..i have never done this before.. thanks for letting me know about this.. can i calculate the diff b/w percentages when i take data for 2 yrs? and show rows based in descending order of %
8.1.05 HTML,PDF,EXL2K, Active, All
April 25, 2011, 06:06 PM
Waz
A simple multi verb statement.
You could also do this in one table request.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
April 26, 2011, 07:45 AM
jimbo
quote:
Originally posted by Enigma006: this is awesome..i have never done this before.. thanks for letting me know about this.. can i calculate the diff b/w percentages when i take data for 2 yrs? and show rows based in descending order of %
or the b/w you could compute a field using the "LAST" but the data needs to be sorted accordingly (i.e. by storecode by year). you may need to hold those results then perform your sort with BY HIGHEST whatever. As WAZ said the first example could be done in one table request, the additional b/w and by highest will probably need to be done in at least 2 passes