Search code examples
reporting-servicesswitch-statementssrs-2008ssrs-expression

Using AND in Switch Expression in SSRS 2008


Below is my code I use in the Color Expression in SSRS 2008 to change the color of the text.

=Switch(Fields!DistanceFromOutlet.Value > 500, "Red",
Fields!DistanceFromOutlet.Value < 250, "White")

How would I say if the DistanceFromOutlet.Value > 250 and < 500 it must be Orange?

So Red text for more than 500.

Orange text for betweeen 250 and 500.

And White text for less than 250.


Solution

  • Nest two IIfs:

    =IIf(Fields!DistanceFromOutlet.Value > 500, "Red", IIf(Fields!DistanceFromOutlet.Value < 250, "White", "Orange"))