Lesson 2: Adding a Matrix Data Region with Row and Column Groups
After the dataset is defined, you can start defining the report layout. Drag a Matrix data region to the design surface, add the fields you want to aggregate, and add the fields you want to group by to the Grouping pane.
To add a matrix data region, row and column groups, and a field to a report layout
Click the Design tab.
In the Toolbox, click Matrix, and then click on the design surface. Report Designer adds a Matrix data region with two columns and two rows. The left corner of the matrix is aligned to the spot that you clicked.
In the Report Data pane, expand the Sales dataset to display the fields.
Note
If you do not see the Report Data pane, from the View menu, click Report Data.
Drag the Category field from the Report Data pane to the matrix cell that displays Rows.
When you drop the field into the cell, the following things happen:
The cell displays the field name, known as the field expression, in brackets: [Category].
The column header value displays the name of the field.
The row handle next to the cell displays a bracket inside the handle that indicates that this row is associated to a group.
The Grouping pane displays the row group Category.
Drag the Geography field from the Report Data pane to the matrix cell that displays Columns.
The column handle displays a bracket for the column group, and the Column Groups pane displays the column group Geography.
Drag the LineTotal field to matrix cell that displays the text Data.
LineTotal represents a numeric field in the dataset. The cell displays the aggregate expression [Sum(LineTotal)].
To add a nested row group
Drag the Subcat field from the Report Data pane to the Row Groups pane, and drop it under the Category group.
When you drop the field on the Row Groups pane, the following things happen:
In the Row Groups pane, the new group Subcat appears, indented under the parent Category group. This shows a nested parent-child relationship.
A new column is added to the matrix, in between the Category column and the Geography column. The cell in the second row displays the field name that you are grouping by: [Subcat].
The column header cell displays the name of the field.
The row handle for the second row displays two nested brackets inside the handle. This indicates that this row is associated to two nested groups.
To add a nested column group
Drag the CountryRegion field from the Report Data pane to the Column Groups pane and drop it under the Geography group.
When you drop the field on the Column Groups pane, the following things happen:
In the Column Groups pane, the new group CountryRegion appears, indented under the parent Geography group.
A new row is added to the matrix between the Geography row and the data row. The nested column header in the third column of the second row displays the field name that you are grouping by: [CountryRegion].
The column handle for the third column displays two nested brackets inside the handle. This indicates that this column is associated to two nested groups.
To add an adjacent column group
In the Column Groups pane, right-click Geography, point to Add Group, and click Adjacent After. The Tablix Group dialog box opens.
In Group by, from the drop-down list, select [Year].
Click OK. When you create this group, the following things happen:
A group with the default name Group1 appears in the Column Groups pane as an adjacent group in relation to the Geography group.
A new column is added after the Geography/CountryRegion column on which to display the group values for Year.
Right-click the cell that contains [Sum(LineTotal)], and then click Copy.
Right-click in the adjacent cell in the Year column, and then click Paste. This adds the aggregate expression [Sum(LineTotal)] for the column group based on [Year].
(Optional) Preview the report.
The report displays unformatted values organized by category, subcategory, geography, countryregion, and year.
Next Task
You have successfully added a Matrix data region with a row group on Category, nested column groups on Geography and CountryRegion, and an adjacent group on Year. Next, you will add totals and format the matrix. See Lesson 3: Formatting a Matrix and Adding Totals.
See Also