The matrix data region arranges data in columns and rows like a cross tab or pivot table. Columns and rows in a matrix can be dynamic or static. Each cell in a matrix contains a textbox report item by default, but as with the other data regions, this can be replaced with any other report item. As with other data regions, the matrix repeats each report item it contains for each row in the dataset, but unlike the others, it also repeats horizontally for dynamic columns.
Cells
When you drop a matrix data region onto your report, there are four cells.
The top left cell is the corner or label cell. You can leave this cell blank or use it to display a label for the matrix.
The top right cell is a column header and the bottom left cell is a row header. You can drag fields into these cells or use expressions to group the data.
The bottom right cell is used to aggregate the detail data. At run time, detail cells display aggregates of the intersections of columns and rows.
Data
The matrix data region is associated with a dataset. You can make this association in the DataSetName property in the property grid.
Groups
You can group the columns and rows in the matrix by right-clicking the matrix and choosing Properties and on the Row Groups or Column Groups page, editing the Group on expression, or by dragging a field into the header cell.
You can nest column and row groups by right-clicking a column or row and choosing to insert a group, or simply by dragging another field onto the column or row into which you want to insert it.
To determine where new groups are displayed, when you drag a field into an existing group you can move the mouse up or down (for columns) or left or right (for rows) to nest the new group within the existing group, or to nest the existing group within the new group.
At run time, the nested group repeats within the original group. For instance, when you drag the City field from your dataset onto a header already grouped by Country, the report displays the first country with all of its cities, then the next country with all of its cities, and so on until all of the countries in the dataset are displayed with all of their cities.
Static Rows and Columns
To insert a static row or column, right-click the detail cell and choose to add a column or row. This displays a column next to or a row above or below the existing one and adds another detail cell.
Aggregates
Groups in a matrix do not subtotal data by default. To add this functionality, right-click the group header and choose Subtotal. This adds a cell to the right of the column, or below the row. Subtotal cells have a green triangle in the upper right corner which allows you to select the subtotal and set its properties in the property grid. For more information, see Aggregates and Scope.
Placement of Data
You can control where data is placed in several ways. You can change the Direction property of the matrix to RTL to cause dynamic column headers to expand left instead of right.
You can also move row headers to the right of the detail cells by changing the GroupsBeforeRowHeaders property of the matrix. The integer value you supply for this property equals the number of instances of the outermost column group that displays to the left of the row headers (or to the left if the Direction property is set to RTL).