Show or Hide SSRS column based on specific parameter value

NonProgrammer picture NonProgrammer · Dec 18, 2014 · Viewed 28.1k times · Source

I am having trouble showing/hiding a column based on parameter value chosen.

How my report is set up: Parameter: ImportStatus --ImportStatus parameter has three values you can choose from: M, V, E

If I choose ImportStatus value = 'M', then I want the report to display a specific column.

Currently, if I go to Column Visibility screen of a column I want to show/hide, I am able to hide column for all values instead of specific. Any idea how to do this correctly?

My expression:

=IIF(Parameters!ImportStatus.Value = "M",true,false)

Answer

SQLDiver picture SQLDiver · Dec 31, 2014

The expression

=IIF(Parameters!ImportStatus.Value = "M",true,false)

will give the same result as

=(Parameters!ImportStatus.Value = "M")

The expression you need to give specifies whether or not to hide the column, so to show a column where @ImportStatus = "M", you would simply reverse the logic:

=Not(Parameters!ImportStatus.Value = "M")