SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Running Total (sum according to a criteria)


Running Total (sum according to a criteria)

Author
Message
Zaza
Zaza
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
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. :-)



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search