Search code examples
sqlreporting-servicesssrs-2008business-intelligencereportbuilder

Hide column based on parameter - SSRS


I have a table with two columns, I want to hide column position when the parameter is single select (multiple value is available).

Have parameter @position which contains 5 values (PG, SG, SF, PF, C) Table look like this

playersName   Position
    
Julio         C 
Julio         PF
Kristofer     PF    
Kristofer     SF
Belle         PG    
Marcella      SG
Adam          PG
Adam          SG

So if I select just SG, I want to hide entire column players and just left playersName column with values (Marcella and Adam) as in eg.

Tried few things inside visibility expression, but I was unsuccessful. Do you have some other ideas?

EDIT: I need expression for SSRS, because I want to hide column in report builder


Solution

  • To hide the Position column set the hidden property of the column to this

    =Parameters!position.Count=1
    

    When a single item is selected the column will be hidden.

    Your dataset query can be set to something like

    SELECT playersName, Position
        FROM myTable
        WHERE Position IN (@position)