SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Calculate percent using prior group in same column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

SQLness
Starting Member

2 Posts

Posted - 11/05/2013 :  13:22:12  Show Profile  Reply with Quote
Trying to duplicate functionality of an excel sheet which calculates percentages within same column using prior group values. Not sure how to construct such a data set.
The column is part of a pivot with an integer value representing a sum.

For example:
GroupVal1
Val1
Val2
Val3
GroupVal2
Val1
Val2
Val3

Need to create a data set to calculate GroupVal2/GroupVal1, (Groupval2) Val1/ GroupVal1 Val1, etc. for all the detail rows.

Any suggestions what SQL to use for this?

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 11/05/2013 :  14:34:10  Show Profile  Reply with Quote
Did you try using ReportItems collection?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

SQLness
Starting Member

2 Posts

Posted - 11/06/2013 :  12:54:38  Show Profile  Reply with Quote
Yes, but they are not in the same group, so not in scope.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 11/06/2013 :  13:10:50  Show Profile  Reply with Quote
did you try using rownumber function?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000