Thursday, December 20, 2018

SSRS - Conditional Formatting By Switch Function

In this tutorial, we will learn How to use Switch function features in your chart report. 
Switch is useful when there are three or more conditions to test because it's simpler to read than nested IIF statements. It's similar to a Case statement in T-SQL. A Switch will return the first expression that it finds true, so the order of the conditions is very important. Switch works like case statement and we can write multiple conditions. Switch evaluate them in sequencer manner and take the first expression that evaluated to true.


As with most things in SSRS you can do something in more than 1 way but today I wanted to introduce you to the Switch Function. 
The SWITCH function allows you to have multiple conditions when evaluating an expression. It evaluates each condition within the function. 

I would recommend you read the expression you have written very carefully because your logic is flawed and that is why sometimes, your SWITCH statement is not working as you believe it should. 

No comments:

Post a Comment