LAG Calculation [message #423003] |
Mon, 21 September 2009 13:23 |
aarti81
Messages: 235 Registered: December 2007 Location: USA
|
Senior Member |
|
|
Hi All,
I have DISTRICT on the Y axis and FY(Fiscal Year) and Amount used as the data points. I have to calculate the growth% for this i used the following calculation:
LAG("Used Amount SUM 1",1) OVER(PARTITION BY 'wmsunitcost salt.Invoice Dt' ORDER BY 'wmsunitcost salt.Invoice Dt' )
But for some reason its not giving any expected results, for example:
FY 2008 2009
AMNT GROWTH% AMNT GROWTH%
DISTRICT A 93,719 60691 40,707 90034
DISTRICT B 101,101 40414 71,012 93719 Where it must give me ("amount for 2008-amount for 2009"/amount for 2008) *100 which is 30% for DISTRICT B. Can any one please tell me if i'm doing any wrong here?
Thanks
|
|
|