Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Running Total (sum according to a criteria) Expand / Collapse
Author
Message
Posted Monday, December 10, 2012 1:33 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, July 23, 2013 8:34 AM
Points: 27, Visits: 39
I'm trying to summarize the Total amount according to the type of paycode (IncomeCode, BenefitCode)..
The IncomeCodes starts with 1 (110, 146 in my example) and the BenefitCodes starts with 5 (540, 560).

Here is an example of my data

Employee Code Total
120000 540 $75.00
120000 560 $10.00
120000 110 $1200.00
120000 146 $45.00
120000 723 $70.00
380000 765 $56.00
380000 110 $985.00
380000 540 $60.00
380000 146 $15.00

I need to setup 2 RunningTotal, one adding up amount for IncomeCode (RunningIncome), the other one for Benefit Codes (RunningBenefit)

The result of my function should be

Employee RunningIncome RunningBenefit
120000 $1245.00 (code 110 + 146) $85.00 (code 540 + 560)
380000 $1000.00 (code 110 + 146) $60.00 (code 540 + 560 none in this case)


As an example, in Crystal report, the formula achieving the RunningIncome is setup as below
Calculate the sum of the Total field only when the value of Code is one of (110, 146), then reset RunningTotal for each Employee

How can I achieve this in SSRS? The RunningValue function does not seem to be flexible enough to sum according to a criteria (summarize only for code 110 and 146)

I thought of filtering the codes needed (only getting the IncomeCodes) in the data source query but my problem is that I need to have the other codes in the report as well for my other running total (RunningBenefit)

Any help would be greatly appreciated.



Post #1394770
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse