Total depending on field values in SSRS

  • Hi,

    I am new to SSRS and just started learning. I came across a situation where I need the total value of a field depending on the values in another field. My dataset contains Item, Quantity , Tax Class and Excise Duty. I grouped on Item so that Item wise I can see the total of Quantity and Excise Duty. Now at the end, what I need is the 'Total Quantity with Excise Duty = 0' and 'Total Quantity with Excise Duty <> 0'. these should be the last 2 rows. Could any one please help me to find the solution. I think it may rather a very easy question, but I am not able to find a solution 🙁

    Thanks in advance,

  • Use below expression in the last rows:

    Total Quantity with Excise Duty = 0

    =SUM(IIF(Fields!ExciseDuty.Value = 0,Fields!Quantity.Value,0))

    Total Quantity with Excise Duty <> 0

    =SUM(IIF(Fields!ExciseDuty.Value <> 0,Fields!Quantity.Value,0))

  • Hi Hari,

    Thanks for your immediate response. This solution is logical, unfortunately while doing a preview, it is giving the result '#Error' value for these fields. I am confused because of this. I have used this in Table Footer, is it be a reason?

    Thanks in advance,

  • It should work in SSRS 2008. I am not sure about SSRS 2005. If that is the case then insert a row (Below Group) and use above expressions.

    But, did you cross check your Fields name mentioned in the expression?

  • Hi Hari,

    It worked with a small modification. I used Switch instead of IIF.

    sum(switch(Fields!Excise_Duty.Value <> 0,round(Fields!Quantity.Value)))

    sum(switch(Fields!Excise_Duty.Value = 0,round(Fields!Quantity.Value)))

    Thanks a lot for your help.

    Cheers,

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply