In this article, we will show you how to Add Row Groups and Column Groups to already created Matrix Reports in SSRS. We are going to use the below-shown report to explain, Grouping in SSRS Matrix Reports.
Please refer Matrix Report, Data Source, and Dataset articles to understand the creation of Data Source, Dataset, and SSRS Matrix report. If you observe the below screenshot, It was a standard Matrix report with State Column as Row Group and Occupation as Column Group.
Add Grouping in SSRS Matrix Reports
In this example, we are going to add a Country column to the Row Grouping and Gender column to Column Grouping. We can add the Column names to the Matrix Grouping in multiple ways:
- We can drag and Drop the Column name from Report data to the Row Grouping Pane or Column Grouping Pane in the position we want. For example, Drop the column name on top of the existing group to add parent grouping in SSRS.
- We can Drag the Column name from Report data to the Row Grouping or Column Grouping Column. For example, Drop the column name beside the existing group to add parent grouping.
NOTE: It is not a good practice to use the above method. Because if you change the direction of a Blue bar, it will give the wrong result.
The third method to add grouping in SSRS Matrix Reports, go to Row groups pane and right-click on the State Group, will open the context menu. Please select Add Group, and then select the Parent Group option. If you want to add a child group, select the Child Group option.
Once you select the Parent Group option, a new Tablix group window will be opened to configure the grouping.
- Group By: Here, you have to specify the grouping column name. Either you can select the column name from the drop-down list or else click on the fx button to create an expression. In this example, we are adding Country as Grouping column so we selected the same from the list
- Add Group Header: Please check mark this option, If you want to add a header to this group
- Add Group Footer: Please check mark this option, If you want to add Footer to this group
Click Ok to finish Adding Row Grouping to existing SSRS Matrix.
Add Column Grouping in SSRS
Goto Column groups pane and right-click on the Occupation Group will open the context menu. From the context, Please select Add Group and then select the Parent Group option. If you want to add a child group, select the Child Group option.
In this example, we are adding Gender as Column Grouping column, so we selected the same from the list
Click Ok to finish Adding Column Grouping to existing SSRS Matrix. From the below screenshot, see that we added Row groups and Column Groups to the existing Matrix. And we also did some Formatting as well.
Click on the Preview button to see the report preview