Table visual in Power BI: exact numbers, done well

When to use the table visual in Power BI, how to add and order columns, totals and why a measure's total is not the sum of its rows, conditional formatting with background colours, data bars and icons, copying values, and a fast table.

Short answer: use a table when people need exact values: a list of orders, customers with their numbers, the detail behind a chart. Drag fields and measures into Columns; each row is a unique combination of the non-measure fields. The total row evaluates each measure for all rows together, which is why a total can differ from the sum of the rows. Conditional formatting adds background colours, font colours, data bars and icons, so a table can be scanned like a chart.

Charts answer "how much, roughly?". The moment someone asks "which ones exactly?" or "what is the number for order 10442?", the answer is a table, and most reports need one under their charts.

When is a table the right visual?

Microsoft lists: numerical data by category with several measures; data in a tabular format with rows and columns; reviewing and comparing detailed data and exact values rather than visual representations. A table with two hierarchy levels and columns across is a matrix.

CustomerRevenueOrdersAvg ordervs LY
Alpine Sports182,400412442.7+12.4%
Bergwerk Bikes141,900298476.2+3.1%
Cyclo Wien96,300251383.7-8.6%
Donau Outdoor88,750190467.1+0.4%
Customers with their revenue, orders and change; colour marks the change

How do you build one?

  1. In Visualizations pick Table.
  2. Drag fields and measures to Columns; their order in the well is the order on screen.
  3. Sort by clicking a column header (Shift plus click adds a second sort column).
  4. In Format visual: Grid (gridlines, borders, row padding), Values (font, colours, alternating row colour, text wrap), Column headers (alignment, wrap), Totals (on or off, and its style), and Specific column to format one column's values, total or header.
  5. Rename a column for this visual only by double-clicking it in the Columns well.

Why does the total not match the sum of the rows?

Because the total is not a sum. It is the measure evaluated once for all the rows together. For a sum measure, that gives the same number. For anything else, it does not:

Avg Order = DIVIDE ( [Revenue], [Orders] )
CustomerRevenueOrdersAvg Order
Alpine Sports182,400412442.7
Cyclo Wien96,300251383.7
Total278,700663420.4

The total 420.4 is total revenue divided by total orders, which is right. Adding up the rows (826.4) or averaging them (413.2) would be wrong. Problems start with measures that use IF or a minimum per row:

Commission =
IF ( [Revenue] > 100000, [Revenue] * 0.05, 0 )

On the total row, revenue is 278,700, so the total commission is 13,935: as if the whole was one customer over the threshold. The right total is the sum of the per-customer commissions, 9,120. Write the measure so it iterates the customers:

Commission =
SUMX (
    VALUES ( Customer[Customer] ),
    IF ( [Revenue] > 100000, [Revenue] * 0.05, 0 )
)

Or use a custom total: right-click the column, Customize total calculation, and pick Sum (or Average, Min, Max) of the displayed rows. It is built on visual calculations and only for numeric columns of tables and matrices.

How do you add colours, bars and icons?

Open the arrow next to a measure in Columns, Conditional formatting:

  • Background color or Font color: a gradient between a minimum and maximum (optionally a centre), rules ("below 0 is red"), or a field value with a colour.
  • Data bars: a bar inside the cell, as long as the value.
  • Icons: arrows or traffic lights by rules.
  • Web URL: turns a text column with links into clickable links.

Conditional formatting can apply to totals and subtotals too ("Values and totals"). For a rule driven by a measure:

Change Colour =
SWITCH ( TRUE (), [Revenue vs LY %] < 0, "#D64550", [Revenue vs LY %] > 0.1, "#1A9E75", BLANK () )

Use it as Background color, Field value: a red cell for a decline, green for over 10% growth, nothing in between.

How do people get the numbers out?

Right-click a cell: Copy, Copy value copies one value without formatting, Copy selection copies the selected cells with their headers, ready to paste into Excel. Export data in the visual's More options (...) exports the whole table, within the limits your admin allows.

What goes wrong?

  • Totals people do not trust. Explain or fix them: iterate in the measure (SUMX) or use a custom total.
  • Too many rows. A table of 100,000 order lines is slow and unreadable. Filter to what matters, or add a Top N filter and a drill-through to the details.
  • Duplicate-looking rows. A table groups by every field in it; a hidden key or an extra column splits rows that look the same. Remove the column or add it on purpose.
  • Columns summed by accident. A dragged numeric column like a price or a year is summed; set it to Don't summarize in the model.
  • A wall of colour. Colour one or two columns that carry the message, not all of them.

Where can you check this?

Where do you start?

Put the few columns people ask about into a table, check every measure's total, and colour only the column that carries the message. SUM vs SUMX explains row-by-row totals, and sparklines add a trend to each row.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.