Treemaps in Power BI
Treemaps display hierarchical data as a set of nested rectangles. Each level of the hierarchy is represented by a colored rectangle (often called a "branch") containing other rectangles ("leaves"). The space inside each rectangle is allocated based on the quantitative value being measured, with the rectangles arranged in size from top left (largest) to bottom right (smallest).
For example, if I'm analyzing my sales, I might have top-level rectangles (branches) for the clothing categories: Urban, Rural, Youth, and Mix. My category rectangles would contain smaller rectangles (leaves) for the clothing manufacturers within that category, and these smaller rectangles would be sized and shaded based on the number sold. In the Urban branch above, lots of Maximus clothing was sold, less Natura and Fama, and very little Leo. So, the Urban branch of my Treemap would have the largest rectangle for Maximus (in the top left corner), slightly-smaller rectangles for Natura and Fama, lots of other rectangles representing all the other clothing sold, and a tiny rectangle for Leo. And I could compare the number of items sold across the other clothing categories by comparing the size and shading of each leaf node; the larger the rectangle and the darker the shading, the higher the value.
When to use a treemap
Treemaps are a great choice:
- to display large amounts of hierarchical data.
- when a bar chart can't effectively handle the large number of values.
- to show the proportions between each part and the whole.
- to show the pattern of the distribution of the measure across each level of categories in the hierarchy.
- to show attributes using size and color coding.
- to spot patterns, outliers, most-important contributors, and exceptions.
- Power BI service or Power BI Desktop
- Retail Analysis sample
Create a basic treemap
Want to watch someone else create a treemap first? Skip to 2:10 in this video to watch Amanda create a treemap.
Or, create your own treemap. These instructions use the Retail Analysis Sample. To follow along, sign in to Power BI service (not Desktkop) and select Get Data > Samples > Retail Analysis Sample > Connect > Go to dashboard. Creating visualizations in a report requires edit permissions to the dataset and report. Luckily, the Power BI samples are editable. But if someone shares a report with you, you won't be able to add new visualizations.
Select the "Total stores" tile to open the Retail Analysis sample report.
Open Editing View and select the Sales > Last Years Sales measure.
Convert the chart to a treemap.
Drag Item > Category to the Group well. Power BI creates a treemap where the size of the rectangles reflects total sales and the color represents the category. In essence you've created a hierarchy that visually describes the relative size of total sales by category. The Mens category has the highest sales and the Hosiery category has the lowest.
Drag Store > Chain to the Details well to complete your treemap. You can now compare last year's sales by category and chain.
Color Saturation and Details cannot be used at the same time.
Hover over a Chain area to reveal the tooltip for that portion of the Category. For example, hovering over Lindseys in the 040-Juniors rectangle reveals the tooltip for Lindsey's portion of the Juniors category.
Highlighting and cross-filtering
For information about using the Filters pane, see Add a filter to a report.
Highlighting a Category or Details in a treemap cross-highlights and cross-filters the other visualizations on the report page... and vice versa. To follow along, either add some visuals to the same page or copy/paste the treemap to a report page that already has other visuals.
On the treemap, select either a Category or a Chain within a Category. This cross-highlights the other visualizations on the page. Selecting 050-Shoes, for example, shows me that last year's sales for shoes was $3,640,471 with $2,174,185 of that coming from Fashions Direct.
In the Last Year Sales by Chain pie chart, selecting the Fashions Direct slice, cross-filters the treemap.
To manage how charts cross-highlight and cross-filter each other, see Visualization interactions in a Power BI report
More questions? Try the Power BI Community