Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSRS Conditional Formatting Switch or IIF

Tags:

I currently have the following 2008 SSRS Report and I want to conditionally format background of the columns based on some logic.

I have three columns and two of which I would like to change the background color. Columns "Current Risk Level", "Trend", "Tolerance". Each contains rows of either Low, Moderate, Medium, High, Very High

For column "Current Risk Level" I would like Low="Green",Moderate="Blue",Medium="Yellow",High="Orange",Very High="Red"

For column "Tolerance" I would like Low="Red",Moderate="Orange",Medium="Yellow",High="Blue",Very High="Green"

I don't know how to set up a SWITCH or IIF function to accomplish this.

Any help would be really appreciated!

like image 413
AKudla Avatar asked Aug 30 '13 17:08

AKudla


People also ask

How do I use IIF in SSRS expression?

Using IIF Function in SSRS We are going to add a new field to the report data set to determine if the Order Year is the Max or Current Year. As shown below, the dataset properties window is opened, and the Fields tab is selected. After clicking Add, at the bottom of the list a new field is added.

How do I write an if statement in SSRS?

The keyword for an If statement in SSRS is IIF. SSRS interprets expressions to set property values and constructs expressions using simple constants, parameters, dataset fields, functions, and operators.

What is IsNothing in SSRS?

Functions are almost always used at some point within an expression. A particular function we are going to touch on in this article is called IsNothing. This function will let you inspect the value of an object to find out if it is NULL or not.


1 Answers

To dynamically change the color of a text box goto properties, goto font/Color and set the following expression

=SWITCH(Fields!CurrentRiskLevel.Value = "Low", "Green", Fields!CurrentRiskLevel.Value = "Moderate", "Blue", Fields!CurrentRiskLevel.Value = "Medium", "Yellow", Fields!CurrentRiskLevel.Value = "High", "Orange", Fields!CurrentRiskLevel.Value = "Very High", "Red" ) 

Same way for tolerance

=SWITCH(Fields!Tolerance.Value = "Low", "Red", Fields!Tolerance.Value = "Moderate", "Orange", Fields!Tolerance.Value = "Medium", "Yellow", Fields!Tolerance.Value = "High", "Blue", Fields!Tolerance.Value = "Very High", "Green") 
like image 147
Anup Agrawal Avatar answered Oct 03 '22 02:10

Anup Agrawal