Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Cross tab formula

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2008-05-26 : 05:18:46

in front end application,iam using pivot table,there is no option to create the growth rate calcuation/formula in FE.

my table data consists like below:
country_name Revenue PERIOD_TYPE_OUT Amount_out
UK Solutions 01 Apr 2007 To 31 Mar 2008 56.83000000
UK Solutions 01 Apr 2006 To 31 Mar 2007 116.07000000

while iam using the cross tab in front end application data view is coming as
country_name

01 Apr 2006 To 31 Mar 2007 01 Apr 2007 To 31 Mar 2008
solution solution
uk 116.07 56.83


Actual o/p should be:

01 Apr 2006 To 31 Mar 2007 01 Apr 2007 To 31 Mar 2008 Growth
solution solution
uk 116.07 56.83 -0.51


can anybody tell how to calcualate growth in stored procedure level formala for calculating growth rate
is :
(56.83-116.07)/116.07
([current year]-[previous year])/[previous year]

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2008-05-26 : 05:25:39
I need to calculate the growth rate by comparing previous year ..how it is possible in sp level logic:


while iam using the cross tab in front end application data view is coming as
country_name 01 Apr 2006 To 31 Mar 2007 01 Apr 2007 To 31 Mar 2008
solution solution
uk 116.07 56.83
Actual o/p should be:

country_name 01 Apr 2006 To 31 Mar 2007 01 Apr 2007 To 31 Mar 2008 Growth

solution solutionuk 116.07 56.83 -0.51




quote:
Originally posted by sent_sara


in front end application,iam using pivot table,there is no option to create the growth rate calcuation/formula in FE.

my table data consists like below:
country_name Revenue PERIOD_TYPE_OUT Amount_out
UK Solutions 01 Apr 2007 To 31 Mar 2008 56.83000000
UK Solutions 01 Apr 2006 To 31 Mar 2007 116.07000000

while iam using the cross tab in front end application data view is coming as
country_name

01 Apr 2006 To 31 Mar 2007 01 Apr 2007 To 31 Mar 2008
solution solution
uk 116.07 56.83


Actual o/p should be:

01 Apr 2006 To 31 Mar 2007 01 Apr 2007 To 31 Mar 2008 Growth
solution solution
uk 116.07 56.83 -0.51


can anybody tell how to calcualate growth in stored procedure level formala for calculating growth rate
is :
(56.83-116.07)/116.07
([current year]-[previous year])/[previous year]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-26 : 05:34:59
Put your current result query in a derived table and take the fields out for calculating the growth value.Post your current query if you need more help on this.
Go to Top of Page
   

- Advertisement -