In this SSRS Tutorial I will show you IIF expression which is also know and IF THEN ELSE statement that allows to provide a condition that can be evaluated to either TRUE or FALSE and provide a value for TRUE part and for FALSE part. In this SSRS Tutorial I will use SQL Server Reporting Services 2008 R2 but it should work with SSRS 2005, 2008 and 2012.
To create SSRS IIF expression please follow my tutorial.
In my example I will check if a person lives in Bristol if yes I will display Yes in a separate column and if not the cell will be blank.
I already have SSRS report and a table and I have fields Surname, City and Country. I insert new column to the right that will contain SSRS IIF expression.
I will call the new columm header 'Lives in Bristol' and I will add IIF expression. To add expression I right click the cell and click expression command.
Expression dialog box appears where I will use IIF function. The first argument is condition and in my case I check if field values is = "Bristol" if yes then "Yes" else "" which means if field value = "Country" then it will return true part of IIF function which is second argument in my case I have values "Yes" else is my false part which means that if City does not equal "Bristol" it will return empty string "" and false part is a third argument n the inline IF (IIF) function.
Below is an example of IIF Expresion
Let's preview our report. You can see our IIF expression worked and if someones lives in Bristol then we get YES else we get nothing.
I hope this SSRS tutorial will help you to create your own SSRS IIF Expressions.