Tuesday, July 4, 2023

SSRS - How to hide and show a chart in the Report

The objective of this article is to provide a way of hiding/showing multiple charts/tablix/matrix etc based on parameter. This is very helpful when we need to display different different charts in the same place based on condition. It will reduce the space in the dasboard also in case we have so many items to display and there is space crunch.

1) Below is the sample report showing 3 charts - Pie, Column & Line. There is an input parameter named Chart Type which is having values -- Pie, Column & Line

2) Now go to chart's property and set the visibility expression for all the 3 Charts so that based on Chart Type parameter's value, it will display the respective chart.


    Expression for Pie Chart - =IIF(Parameters!ChartType.Value = "Pie",False,True)
    Expression for Column Chart - =IIF(Parameters!ChartType.Value = "Column",False,True)
    Expression for Line Chart -=IIF(Parameters!ChartType.Value = "Line",False,True)

3) Now we are going to overlap one over the other.

4) Then It will look like single chart and occupy the space of single chart only.


5) Now run the report and select Chart Type parameter value as Pie. You can see only Pie chart


6) Now run the report and select Chart Type parameter value as Column. You can see only Column chart
7) Now run the report and select Chart Type parameter value as Line. You can see only Line chart


No comments:

Post a Comment