A Power BI Matrix is similar to a table that contains rows and columns. However, the matrix shows the aggregated data instead of displaying the detailed rows. The aggregation of the numeric measure depends on the column and row headers. If you add a hierarchy to column or row headers, you can drill up and down based on the levels.
When to use a matrix
- To display the aggregated information in tabular format.
- To perform row and column grouping.
- To view row and column subtotals, totals, and grand totals.
- To enable drill down action across the report.
Power BI Matrix, called the Cross tab, helps display the relationships between two or more groups. Let me show you how to Create a Matrix with an example.
How to Create a Matrix in Power BI
When you drag any dimension field to the Canvas, it automatically creates a table. Let me drag and drop the English Product Name from the Fields section to Canvas. And you can see the table.
Next, drag one metric value (Sales Amount) to the Values section and click on the Matrix under the Visualization section.
Clicking the button will automatically convert a Table into a Power BI Matrix. For example, the screenshot below shows the cross tab representation of English Product names and Sales Amounts.
Let me add one more column group so that you can understand the cross tab. As you can see, we added Customer gender to the Column Groups.
Create a cross tab in Power BI Approach 2
You can follow this step if you want to convert the existing chart into Power BI Matrix.
As you can see from the screenshot below, we created a column chart representing the Order Quantity by English Product Subcategory.
Click on the below-shown icon under the Visualization section automatically convert the Column Chart into a cross tab.
Let me add the Product Color to the Column Group
To create it, First, click on the Power BI Matrix present in the Visualization section. It automatically creates a cross tab with dummy data. Next, let me add the product Color as the Row Group.
Next, drag and drop the English Occupation into the Column Groups. Now, you can see the cross tab.
Next, let me drag the Sales Amount to the Values section. It automatically enables the Subtotals and grand totals.
For this demonstration, we are adding one more metric field, i.e., Total Product Cost, to the Values section.
Let me do some quick formatting to this Power BI Matrix
NOTE: I suggest you refer to Format a Cross Tab article to understand the formatting options.
A table displays the data in a two-dimensional format. So, it shows detailed information and duplicates records.
A matrix displays the data in a layered or stepped layout. And the important aspect is that the matrix automatically aggregates the measure (numeric) fields. The second one is that it enables a drill down approach.
Under the Visualization section, Selecting the Matrix icon will generate a dummy Matrix. Next, add dimensions to both Rows and Columns section and the Numeric measure to values. Apart from this, you can convert an existing table to a matrix.
Add Hierarchy to rows section creates a drill down action for rows. Whereas adding a hierarchy to columns enables the column-wise drill down action.