Sub topic 9
When a table or matrix is the right answer
This chapter assumes you can build a basic visual on the Power BI Desktop canvas. It also assumes you have a data model with related tables and that you know the sum, average and count aggregations. Measures such as [Total Sales] and [Sales LY] are reused from earlier chapters.
Charts show patterns. Tables and matrices show exact values. Choose one of them when the reader needs to read, look up or compare specific numbers more than they need to see a shape.
When a table or matrix beats a chart
A table or matrix is usually the better choice in these cases:
- The reader needs exact values, such as an invoice total or a stock count.
- The report mixes measures with different units, such as revenue, margin percent and order count. A single chart axis cannot hold them honestly.
- There are many fields to show side by side, and each row is one thing, such as an order or a customer.
- The reader will export the data or copy it into another tool.
- You want a detail view that opens after the reader has narrowed things down with a summary chart.
A chart is usually better when the question is "which is bigger" or "is it going up". Rank, trend and share are patterns, and the eye reads them faster from a shape than from a column of numbers.
The starter lookup table in this tutorial puts it this way: for "Exact values, many fields", use a table or matrix.
Table versus matrix
Both visuals show rows of values. They differ in how they group them.
| Feature | Table | Matrix |
|---|---|---|
| Layout | Flat grid, one row per combination of fields | Grouped, with row and column headers |
| Column headers from data | No, columns are the fields you add | Yes, a field in Columns spreads its values across the top |
| Subtotals and grand totals | Grand total only | Row and column subtotals and grand totals |
| Expand and collapse | No | Yes, on the row hierarchy |
| Best for | Lists and detail records | Cross-tabs and hierarchies |
A table is a list. A matrix is a cross-tab, which is a grid where one field runs down the side and another runs across the top. Use a table when each row stands alone. Use a matrix when the reader needs to compare across two dimensions, such as category by year.
Building each visual
The field wells
A table has a single Columns well. Every field you drop there becomes a column. Categorical fields give one row per distinct combination. Numeric fields are aggregated, or they are measures.
A matrix has three wells:
- Rows sets the row groups. Adding several fields creates a hierarchy.
- Columns spreads the values of a field across the top.
- Values holds the measures or aggregated fields.
A worked example
Suppose you want to see sales by product category and year, with year-over-year change. Build a matrix:
- Put
Product[Category]in Rows. - Put
'Date'[Year]in Columns. - Put
[Total Sales]in Values.
Then add a second measure for the change. The DIVIDE function returns blank instead of an error when the prior-year value is zero or blank:
Sales YoY % =
DIVIDE ( [Total Sales] - [Sales LY], [Sales LY] )This measure depends on [Sales LY], which uses SAMEPERIODLASTYEAR and so needs a marked date table.
If you drop both measures into Values, the matrix shows two numbers under each year. Under Format > Values, you can turn on Show on rows for measures. This puts the measure names down the side instead of across the top, which keeps wide matrices readable.
Reading a table or matrix quickly
Plain grids of numbers are slow to read. Three formatting tools help.
Conditional formatting
Conditional formatting changes a cell's background color, font color, data bars or icons based on its value. Open the field's drop-down in the Values well and choose Conditional formatting. For Sales YoY %, a diverging color rule is a good fit. Use one color for negative values and another for positive values, with a neutral midpoint at 0.
Data bars add a small bar inside each cell. They give some of a bar chart's ranking effect without losing the number. They suit a single measure. Several measures with data bars in one grid become noisy.
Do not rely on color alone. Some readers cannot tell red from green. Pair color with icons or a sign, such as an up or down arrow.
Sorting and order
Click a column header to sort a table by that column. Click again to reverse. In a matrix, sorting applies to the row groups. Sort by the measure that matters most, usually largest first, so the reader sees the important rows at the top. Months and weekdays need a sort-by-column setting so that they follow calendar order and not alphabetical order.
Totals, subtotals and alignment
Totals are on by default. Turn them off when they mislead, for example when the measure is a ratio or an average. A grand total of Sales YoY % is not the sum of the row percentages. It is the measure evaluated over all rows. That is correct, but readers often expect a sum, so label the total clearly or hide it.
Right-align numbers and use the same number of decimal places down a column. Use display units, such as thousands, when full precision adds no value.
Hierarchies and drill in a matrix
A matrix can hold a hierarchy in Rows, such as Category, then Subcategory, then Product. The reader can expand and collapse levels. Use Expand all down one level in hierarchy to open the next level for every row. Use Drill down on a single row to focus on its children.
Start with the top level collapsed. The reader sees a short summary and opens only the branches they care about. This answers the common complaint that a matrix with thousands of expanded rows is unusable.
Common problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Table shows far fewer rows than expected | Fields from unrelated tables, or a filter on the page | Check the relationships and the Filters pane |
| A number appears repeated on every row | The measure ignores the row field, or the field comes from a table with no relationship | Check the relationship, or use a measure that responds to the filter |
| A numeric field is summed when you wanted each value | Default aggregation is Sum | Choose **Don't summarize** from the field's drop-down |
| Matrix columns are very wide and scroll sideways | Too many distinct values in Columns | Move the field to Rows, or filter it |
| Months sort as April, August, December | Text sorted alphabetically | Set **Sort by column** to the month number |
| Totals look wrong for a ratio | Total is evaluated over all rows, not summed | Hide totals, or label them |
Choosing between a table, a matrix and a chart
Walk through these questions in order:
- Does the reader need a pattern, such as rank, trend or share? Use a chart. Add a table or matrix only as supporting detail.
- Does the reader need exact numbers? Continue.
- Do you need to compare across two dimensions, or show subtotals and a hierarchy? Use a matrix.
- Is each row an individual record, or are the fields unrelated measures? Use a table.
Limits and design advice
- A large table is not a report. Pair a summary chart with a detail table. Selecting a bar in the chart cross-filters the table to the matching rows.
- Keep the number of columns small. Beyond about seven or eight, readers lose track of which row they are on.
- Use a table as a drill-through or tooltip target for record-level detail. The summary page stays clean, and the detail is one click away.
- Screen readers read tables well when column names are clear. Rename fields in the visual so headers say what the values mean, such as "Sales (USD)" instead of "Sum of SalesAmount".
Exercise
A manager wants to compare sales for 12 product categories across 3 years and see a subtotal for each year. A second user wants a list of every order from last week with order ID, customer, status and amount. Which visual should each user get, and why?
Show answer
The manager needs a matrix. Category goes in Rows, Year goes in Columns, and [Total Sales] goes in Values. A matrix compares across two dimensions and provides subtotals and grand totals. The second user needs a table. Each row is one order, the fields are unrelated, and no cross-tab or subtotals are needed. If the manager also wants to see which category is largest at a glance, a sorted bar chart beside the matrix would show rank faster than the numbers do.
Exercise
Your matrix shows Sales YoY % by category, and the grand total row shows 4.2% while the category percentages average about 7%. A colleague says the total is wrong. What is the explanation, and what are two sensible responses?
Show answer
The grand total is not an average or a sum of the rows. Power BI evaluates DIVIDE ( [Total Sales] - [Sales LY], [Sales LY] ) over all rows combined, so larger categories weigh more. The total is correct for the whole business. You can either keep it and label it clearly, for example as "All categories", or turn off totals for this visual so readers do not compare it with the row values.