The matrix in Power BI: rows, columns and totals
The matrix is the visual for numbers in detail: rows, columns, subtotals and a grand total, like a PivotTable in Excel. Here you learn to build it and to read its totals correctly.
In short: fields in Rows and Columns form the groups, Values fill the cells. Several fields in Rows give a hierarchy with subtotals. Every total recalculates the measure; it does not add up the rows above.
Prerequisites: Create a visual.
Try it now
Two fields in Rows: category on top, product below. Then click a number in the matrix to see which filters it was calculated with.
Task Build a matrix with sales per category and per product below it: put Product[Category] first and Product[Product] second into Rows, and [Total Sales] into Values.
Sales 120 rows, 7 columns
| OrderID | OrderDate | ShipDate | ProductID | RegionID | Quantity | Amount |
|---|---|---|---|---|---|---|
| 1 | 3 Oct 2026 | 6 Oct 2026 | 1 | 2 | 2 | 1798 |
| 2 | 9 Nov 2025 | 19 Nov 2025 | 2 | 3 | 5 | 1145 |
| 3 | 20 Sep 2026 | 27 Sep 2026 | 5 | 4 | 4 | 596 |
| 4 | 16 Jun 2025 | 2 Jul 2025 | 2 | 1 | 5 | 1145 |
| 5 | 26 Mar 2026 | 31 Mar 2026 | 1 | 3 | 4 | 3596 |
| 6 | 4 Dec 2025 | 10 Dec 2025 | 5 | 4 | 5 | 745 |
| 7 | 8 Jul 2025 | 26 Jul 2025 | 6 | 1 | 4 | 196 |
| 8 | 20 Feb 2025 | 1 Mar 2025 | 3 | 2 | 3 | 59.7 |
| 9 | 9 Dec 2025 | 24 Dec 2025 | 6 | 2 | 2 | 98 |
| 10 | 12 Aug 2026 | 25 Aug 2026 | 2 | 1 | 2 | 458 |
| 11 | 7 Sep 2026 | 12 Sep 2026 | 5 | 4 | 2 | 298 |
| 12 | 2 Mar 2026 | 14 Mar 2026 | 6 | 2 | 3 | 147 |
Showing the first 12 of 120 rows.
Measures: [Total Sales]
Product 6 rows, 4 columns
| ProductID | Product | Category | Price |
|---|---|---|---|
| 1 | Laptop | Hardware | 899 |
| 2 | Monitor | Hardware | 229 |
| 3 | Mouse | Accessories | 19.9 |
| 4 | Keyboard | Accessories | 39.9 |
| 5 | Office suite | Software | 149 |
| 6 | Antivirus | Software | 49 |
Region 4 rows, 2 columns
| RegionID | Region |
|---|---|
| 1 | North |
| 2 | South |
| 3 | West |
| 4 | East |
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
Showing the first 12 of 730 rows.
Rows, columns, values
Every cell of the matrix holds the same calculation, just with different filters. The "Hardware" cell in the [Total Sales] column calculates sales with the filter Category = Hardware. The "Laptop" cell below it has the filter Product = Laptop (and therefore the Hardware category too).
- Rows: one or more fields. Several fields form a hierarchy: category, with product below.
- Columns: optional. Each value of the field becomes a column of its own, with a total column on the right.
- Values: measures or summarized number columns. Without a field in Columns, each value gets its own column.
Subtotals and grand total
The "Total" row at the bottom and the category subtotals look like sums of the rows above. In fact Power BI calculates the measure again there, just with fewer filters: the subtotal with the filter on the category alone, the total row with no row filter at all. For a sum the result is the same. For an average, a distinct count or a percentage it is not: the average of all orders is not the average of the product averages.
This rule is the key to almost everything that comes later in DAX. Remember it now: every cell is a calculation of its own with its own filters.
A field in Columns
With a field in Columns, the matrix becomes a cross table, ideal for comparisons such as year against year.
Task Compare the years side by side: matrix with Region[Region] in Rows, 'Date'[Year] in Columns and [Total Sales] in Values.
Sales 120 rows, 7 columns
| OrderID | OrderDate | ShipDate | ProductID | RegionID | Quantity | Amount |
|---|---|---|---|---|---|---|
| 1 | 3 Oct 2026 | 6 Oct 2026 | 1 | 2 | 2 | 1798 |
| 2 | 9 Nov 2025 | 19 Nov 2025 | 2 | 3 | 5 | 1145 |
| 3 | 20 Sep 2026 | 27 Sep 2026 | 5 | 4 | 4 | 596 |
| 4 | 16 Jun 2025 | 2 Jul 2025 | 2 | 1 | 5 | 1145 |
| 5 | 26 Mar 2026 | 31 Mar 2026 | 1 | 3 | 4 | 3596 |
| 6 | 4 Dec 2025 | 10 Dec 2025 | 5 | 4 | 5 | 745 |
| 7 | 8 Jul 2025 | 26 Jul 2025 | 6 | 1 | 4 | 196 |
| 8 | 20 Feb 2025 | 1 Mar 2025 | 3 | 2 | 3 | 59.7 |
| 9 | 9 Dec 2025 | 24 Dec 2025 | 6 | 2 | 2 | 98 |
| 10 | 12 Aug 2026 | 25 Aug 2026 | 2 | 1 | 2 | 458 |
| 11 | 7 Sep 2026 | 12 Sep 2026 | 5 | 4 | 2 | 298 |
| 12 | 2 Mar 2026 | 14 Mar 2026 | 6 | 2 | 3 | 147 |
Showing the first 12 of 120 rows.
Measures: [Total Sales]
Product 6 rows, 4 columns
| ProductID | Product | Category | Price |
|---|---|---|---|
| 1 | Laptop | Hardware | 899 |
| 2 | Monitor | Hardware | 229 |
| 3 | Mouse | Accessories | 19.9 |
| 4 | Keyboard | Accessories | 39.9 |
| 5 | Office suite | Software | 149 |
| 6 | Antivirus | Software | 49 |
Region 4 rows, 2 columns
| RegionID | Region |
|---|---|
| 1 | North |
| 2 | South |
| 3 | West |
| 4 | East |
Date 730 rows, 4 columns
| Date | Year | Month | MonthName |
|---|---|---|---|
| 1 Jan 2025 | 2025 | 1 | Jan |
| 2 Jan 2025 | 2025 | 1 | Jan |
| 3 Jan 2025 | 2025 | 1 | Jan |
| 4 Jan 2025 | 2025 | 1 | Jan |
| 5 Jan 2025 | 2025 | 1 | Jan |
| 6 Jan 2025 | 2025 | 1 | Jan |
| 7 Jan 2025 | 2025 | 1 | Jan |
| 8 Jan 2025 | 2025 | 1 | Jan |
| 9 Jan 2025 | 2025 | 1 | Jan |
| 10 Jan 2025 | 2025 | 1 | Jan |
| 11 Jan 2025 | 2025 | 1 | Jan |
| 12 Jan 2025 | 2025 | 1 | Jan |
Showing the first 12 of 730 rows.
Matrix or table?
The Table visual shows columns side by side without hierarchy or column groups, similar to an Excel list with a total row. The Matrix groups in two directions and shows subtotals. If you know PivotTables from Excel, you will usually reach for the matrix.
In real Power BI
- Insert a matrix: the Matrix icon in the Visualizations pane.
- Add fields: drag them into Rows, Columns and Values. The order in Rows defines the hierarchy.
- Expand levels: with two fields in Rows the matrix first shows the top level. “Expand all down one level” (the arrows on the visual, or right-click) shows every row of the next level.
- Set totals: in the Visualizations pane under Format you switch Row subtotals and Column subtotals on and off.
Common mistakes
Year ends up in Values
'Date'[Year] is a number. Ticking it puts it into Values and adds up the year numbers to a meaningless large number. Drag the field into Columns or Rows.
Row order swapped
With product above category, every group has only one child row. The coarser grouping belongs on top.
Recalculating the total row
If you recalculate the total row from the rows with a calculator, you will find differences for averages. That is not a Power BI bug but the rule above.
Frequently asked questions
Is the matrix the same as a PivotTable?
Almost. Both group in rows and columns. The matrix, however, calculates over the whole data model with relationships and filters together with the other visuals on the page.
Why are some rows missing?
Power BI hides rows where every value is blank, such as a product with no sales in the selected year. Under the field, Show items with no data brings them back.