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
OrderIDOrderDateShipDateProductIDRegionIDQuantityAmount
13 Oct 20266 Oct 20261221798
29 Nov 202519 Nov 20252351145
320 Sep 202627 Sep 2026544596
416 Jun 20252 Jul 20252151145
526 Mar 202631 Mar 20261343596
64 Dec 202510 Dec 2025545745
78 Jul 202526 Jul 2025614196
820 Feb 20251 Mar 202532359.7
99 Dec 202524 Dec 202562298
1012 Aug 202625 Aug 2026212458
117 Sep 202612 Sep 2026542298
122 Mar 202614 Mar 2026623147

Showing the first 12 of 120 rows.

Measures: [Total Sales]

Product 6 rows, 4 columns
ProductIDProductCategoryPrice
1LaptopHardware899
2MonitorHardware229
3MouseAccessories19.9
4KeyboardAccessories39.9
5Office suiteSoftware149
6AntivirusSoftware49
Region 4 rows, 2 columns
RegionIDRegion
1North
2South
3West
4East
Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

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
OrderIDOrderDateShipDateProductIDRegionIDQuantityAmount
13 Oct 20266 Oct 20261221798
29 Nov 202519 Nov 20252351145
320 Sep 202627 Sep 2026544596
416 Jun 20252 Jul 20252151145
526 Mar 202631 Mar 20261343596
64 Dec 202510 Dec 2025545745
78 Jul 202526 Jul 2025614196
820 Feb 20251 Mar 202532359.7
99 Dec 202524 Dec 202562298
1012 Aug 202625 Aug 2026212458
117 Sep 202612 Sep 2026542298
122 Mar 202614 Mar 2026623147

Showing the first 12 of 120 rows.

Measures: [Total Sales]

Product 6 rows, 4 columns
ProductIDProductCategoryPrice
1LaptopHardware899
2MonitorHardware229
3MouseAccessories19.9
4KeyboardAccessories39.9
5Office suiteSoftware149
6AntivirusSoftware49
Region 4 rows, 2 columns
RegionIDRegion
1North
2South
3West
4East
Date 730 rows, 4 columns
DateYearMonthMonthName
1 Jan 202520251Jan
2 Jan 202520251Jan
3 Jan 202520251Jan
4 Jan 202520251Jan
5 Jan 202520251Jan
6 Jan 202520251Jan
7 Jan 202520251Jan
8 Jan 202520251Jan
9 Jan 202520251Jan
10 Jan 202520251Jan
11 Jan 202520251Jan
12 Jan 202520251Jan

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

  1. Insert a matrix: the Matrix icon in the Visualizations pane.
  2. Add fields: drag them into Rows, Columns and Values. The order in Rows defines the hierarchy.
  3. 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.
  4. 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.

Learn this next: filters and slicers

Narrow the report down to a year, a region or a category with one click.

Filters and slicers

Write to us

Choose language

Select your preferred language