reporting-services

Switch Expression

Changing text color using switch condition

Let’s assume we have an entity status field with 3 options

  • Tentative
  • Pending
  • Approved

Our goal is to show different color for each status as follow: Tentative will be Red Pending will be Orange Approved will be Green

The switch condition:

=Switch(Fields!ItemStatus.Value = "Tentative","Red",
Fields!ItemStatus.Value = "Pending", "Orange",
Fields!ItemStatus.Value = "Approved", "Green")

The pattern is:

=Switch([Condition statement] , [Value if True],
[Condition statement] , [Value if True],
[Condition statement] , [Value if True])

The second , sign starts a new condition. No , sign is needed for the last condition.

Results:

enter image description here


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow