1
votes

I am trying to apply condition formatting on an SSRS expression that is already using an IIF statement in order to return it's value correctly. Is this possible?

The expression:

=SUM(IIf(RIGHT(Fields!Category.Value, 2) = "01", CDBl(Fields!Cost.Value), CDBL(0)))

The below switch is what I would like to use in order to apply a red/green background accordingly in the fill property, but I am not sure how to do so because I need to first evaluate the IIF in order to know the value to base the color upon. Any ideas?

The switch:

=Switch( 
(
Fields!Cost.Value <= .8944), "Red", 
Fields!Cost.Value > 1.0945), "Red", 
1=1, "Green" 
) 

Ideally I would rework my stored procedure/groupings so that the IIF was not needed here and I could just do the conditional formatting on Fields!Cost.Value, but that is not possible given the quick turnaround needed here.

1

1 Answers

3
votes

Looks like I've figured it out, I was able to nest the IIF statement being used and the formatting is working correctly.

=Switch(
    (SUM(IIf(RIGHT(Fields!Category.Value, 2) = "01", CDBl(Fields!Cost.Value), CDBL(0)))) <= .8944, "Red", 
    (SUM(IIf(RIGHT(Fields!Category.Value, 2) = "01", CDBl(Fields!Cost.Value), CDBL(0)))) > 1.0945, "Red", 
    1=1, "Green" 
    )