whitz11
whitz11

Reputation: 229

SSRS calculation expression for specific value

I'm looking at doing a calculation expression in SSRS but I've become unstuck.

I'm trying to calculate when a field equals a specific value, then return a percentage calculation.

This is what I've tried so far:

=SUM(IIF(Fields!Alert.Value="Red",(FormatPercent(Count(Fields!Sales.Value) / 6532 ,0)))SUM(IIF(Fields!Alert.Value="Yellow",(FormatPercent(Count(Fields!Sales.Value) / 2541 ,0)))SUM(IIF(Fields!Alert.Value="Green",(FormatPercent(Count(Fields!Sales.Value) / 1025,0)))

Obviously this is incorrect and doesn't work. The expression needs to include all 3 colours.

Upvotes: 0

Views: 344

Answers (1)

SS_DBA
SS_DBA

Reputation: 2423

UPDATED see if this works.

UPDATED per requested. I put the statement in the last False part, but I'm not sure if this is what you really want.

UPDATED again. Added False part to the last IIF statement.

UPDATED: Removed the SUM function. Try this to see if it works. Your IIF statement didn't have any False parts. Also, just SUM once around the whole statement if you want it summed. Not knowing your data, I'm not sure if you want the % summed up.

=IIF(Fields!location.Value="East" AND Fields!Alert.Value="Red",(FormatPercent(Count(Fields!Sales.Value) / 6532 ,0)),IIF(Fields!Alert.Value="Yellow",FormatPercent(Count(Fields!Sales.Value) / 2541 ,0),IIF(Fields!Alert.Value="Green",FormatPercent(Count(Fields!Sales.Value) / 1025,0),0)))

Upvotes: 1

Related Questions