Conditional Sum in SSRS - BIDS
Hi,
I want to include or exclude values to be added in my total sum based on the values in participation column. How do i do it?
ID Amt Participation
121 100 1
123 200 0
124 300 0
So, the total from my conditional statement should be 500 not 600 because I want to avoid adding the value with participation value of 1.
November 1st, 2010 12:34pm
Do conditional Sum using IIF.
like
=IIf((Fields!Type1.Value='1'
), Sum(Fields!Amount.Value), "$0.00")
Free Windows Admin Tool Kit Click here and download it now
November 1st, 2010 2:04pm
Thank you.
November 1st, 2010 2:36pm
did it solve yr. purpose?SSRSRpt
Free Windows Admin Tool Kit Click here and download it now
November 1st, 2010 4:29pm
No somehome it is not working. I am still trying. Thank you for the follow up.
November 1st, 2010 4:59pm
Hi,
In order to achieve the conditional sum, we need to use IIf() function in Sum() function.
For example, we can calculate the aggregate sum for only the Participation is 0 by the expression like
=Sum(IIf(Fields!Participation.Value=1,0,Fields!Amt.Value))
Thanks,
Tony ChainPlease remember to mark the replies as answers if they help and unmark them if they provide no help
Free Windows Admin Tool Kit Click here and download it now
November 3rd, 2010 3:04am
You are correct Tony but you have to used CDBL to make sure there is no error so the formula I used that seems to be working is below.
=Sum(IIf(Fields!Participation.Value=1,CDBL(0),CDBL(Fields!Amt.Value)))
I appreciate all your replies. Thank you.
November 3rd, 2010 10:51am