Show or hide column in a subreport based on main report's input paramater

Jahnavi Sriram 1 Reputation point


I have a report which takes input parameters from drop down and then I have a subreport which shows up when user selects a particular value from paramater drop down in the main report.

Now, my requirement is, I have to create another input paramater in the main report which has values "yes" and "no".
If a user selects "Yes" , then it should show up a column from subreport , oherwise hide this particular column.

How do we show or hide a column in subreport based on main report's input paramater?

Any help would be appreciated.

Thanks in advance

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,642 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Joyzhao-MSFT 15,536 Reputation points

    Hi @Jahnavi Sriram ,
    As you said, the subreport works fine for now.
    If you add a new parameter [OR] based on the existing main report, the parameter values are "Yes" and "No", and the settings are as follows:



    Similarly, set this parameter in your subreport, and the operation is the same as above. In my case, when the parameter selection is "Yes", the column [Month] is displayed, otherwise it is not displayed. The expression to set the visibility of this column is as follows: =IIF(Parameters!OR.Value="Yes",False,True)


    Switch to the main report, select the subreport, and set Subreport Properties. The second parameter is the parameter created above for hiding/showing subreport columns. In the drop-down list of [Name], select the parameter of the subreport (parameter [OR] in my case), and select the expression in [Value]: =Parameters!OR.Value(This is the value that the main report needs to pass to the subreport.)
    As shown below:

    Now you can run your main report, when the second parameter [OR] is "Yes", the column [Month] will be displayed; when the second parameter [OR] is "No", the column [Month] will not be displayed .
    Best Regards,

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments