Hari
Hari

Reputation: 192

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.

Upvotes: 2

Views: 1832

Answers (2)

Hari
Hari

Reputation: 192

I used nothing instead of 0, it's worked for me. Thanks for your help.

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

Upvotes: 0

alejandro zuleta
alejandro zuleta

Reputation: 14108

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.

Upvotes: 3

Related Questions