Short answer: a treemap fills a rectangle with smaller rectangles, each sized by its value, so it shows many parts of a whole at once, and parts within parts. In Power BI, the Category field makes the coloured branch nodes, the optional Details field splits each branch into leaf nodes, and Values sizes them. The largest branch sits at the top left, the smallest at the bottom right. Use it when there are too many categories for a pie and the question is "what are the big blocks?".
The chart, part by part: What is a treemap? draws its parts and shows how to read one, its kinds and the mistakes to avoid.
A pie with 30 slices is useless, and a bar chart with 30 bars shows the ranking but not that the top five make up 70% of the total. A treemap shows both: the big blocks dominate, the long tail shrinks to small tiles.
What does a treemap look like?
When is it the right chart?
Microsoft lists the cases: large amounts of hierarchical data; more values than a bar chart can show well; proportions between each part and the whole; how the measure is spread across each level of a hierarchy; size and colour as two attributes at once; and spotting the biggest contributors, outliers and exceptions.
| The data | Chart |
|---|---|
| 2 to 5 parts | pie or donut |
| Up to about 15 parts, exact ranking matters | bar chart |
| Many parts, or parts within parts, the big picture matters | treemap |
| Parts compared precisely with each other | bar chart (areas are hard to compare) |
How do you build one?
- In Visualizations pick Treemap. The wells are Category, Details, Values and Tooltips.
- Drag the measure to Values and the top level, for example
Product[Category], to Category. - For leaves, drag a second field to Details, for example
Store[Chain]: each category is split into chains, coloured as their category. - Turn on Data labels and Category labels in Format visual; small tiles hide their labels when they do not fit, so the hover tooltip carries the rest.
A treemap highlights and cross-filters like other visuals: selecting a tile filters or highlights the other visuals on the page, and selecting elsewhere highlights the matching part of each tile.
What DAX goes with a treemap?
The share of each tile, for the tooltip:
Share of Revenue =
DIVIDE ( [Revenue], CALCULATE ( [Revenue], REMOVEFILTERS ( 'Product' ) ) )Size and colour can say two different things. Size by revenue, colour by margin: Format visual, Colors, fx, Gradient based on Margin %, so a big pale tile is a big seller with a thin margin.
Margin % =
DIVIDE ( [Revenue] - [Cost], [Revenue] )With colour by a measure, the tiles no longer share their category colour; that is the point, but say so in the title ("size: revenue, colour: margin").
What goes wrong?
- Comparing similar tiles. Two tiles of 12% and 14% look the same, and a tall thin tile looks smaller than a square one of the same area. Put the numbers in labels or tooltips, or use bars for the comparison.
- Negative values. A tile cannot be negative; categories with net returns vanish.
- Too many levels. Category and details are plenty; a third level turns tiles into confetti. Drill instead.
- Colour that means nothing. Default colours per category are decoration; if colour carries a measure, add a legend that says so.
Where can you check this?
- Microsoft Learn: Treemaps in Power BI
- Microsoft Learn: Apply conditional formatting in tables and matrixes
Where do you start?
Use a treemap for "what are the big blocks?" across many categories, add a Details level only if it helps, and keep exact comparisons for a bar chart. The pie chart post covers the small-whole case, and the decomposition tree breaks a total down level by level.