Search code examples
reporting-servicesssrs-2008-r2ssrs-expression

SSRS expression based on Field value


I have a matrix report. i am calculating by using this expression,

=switch(Fields!Type.Value = "ATHLETE",Sum(Fields!JnlAmt.Value)
,Fields!Type.Value = "Type",0.8*Sum(Fields!JnlAmt.Value)
,Fields!Type.Value = "VENUE", Sum(Fields!JnlAmt.Value))

Now i would like to find the difference of Athlete and Type

=Sum(Fields!JnlAmt.Value) [from Athlete] - 0.8*Sum(Fields!JnlAmt.Value) [from Type]

I need help to write an expression for this. If you need more information, let me know. Please any help, any taught is welocme.


Solution

  • I think you can achieve that by using a conditionally Sum(). Despite I know nothing about grouping and data arrangement in your matrix, I think you are looking for this expression:

    =Sum(IIF(Fields!Type.Value="ATHLETE",Fields!JnlAmt.Value,0))-
    0.8*Sum(IIF(Fields!Type.Value="Type",Fields!JnlAmt.Value,0))
    

    I've created a simple matrix for example purpose.

    enter image description here

    6 - (0.8 * 15) = -6
    

    Hopefully this what you are looking for, let me know if this helps.