Focal Point
[CLOSED] total by yr and % - urgent

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

April 25, 2011, 02:29 PM
Enigma006
[CLOSED] total by yr and % - urgent
Hi

Im working on a report. I need some help on it.

Table has data of sale amount for each State for year.

  

State     Year    Sales
Alabama   2009    10000
Alabama   2010    20000
Alabama   2011    15000
Arizona   2009    12000
Arizona   2010    24000
Arizona   2011    13000




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.

Thanks

This 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  



7.7.04
Win2K3, Unix
Oracle 10G,SQL2K,XFOCUS,ESRI,BID,MRE,SELF-SERVICCE
April 25, 2011, 04:55 PM
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 %


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.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs: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


7.7.04
Win2K3, Unix
Oracle 10G,SQL2K,XFOCUS,ESRI,BID,MRE,SELF-SERVICCE