# Treemaps in Power BI

APPLIES TO: Power BI Desktop Power BI service

Treemaps display hierarchical data as a set of nested rectangles. Each level of the hierarchy is represented by a colored rectangle (branch) containing smaller rectangles (leaves). Power BI bases the size of the space inside each rectangle on the measured value. The rectangles are arranged in size from top left (largest) to bottom right (smallest).

For example, if you're analyzing your sales, you might have top-level branches for the clothing categories: Urban, Rural, Youth, and Mix. Power BI would split your category rectangles into leaves, for the clothing manufacturers within that category. These leaves would be sized and shaded based on the number sold.

In the Urban branch above, lots of VanArsdel clothing was sold. Less Natura and Fama was sold. Only a few Leo were sold. So, the Urban branch of your Treemap has:

• The largest rectangle for VanArsdel in the top-left corner.

• Slightly smaller rectangles for Natura and Fama.

• Lots of other rectangles for all the other clothing sold.

• A tiny rectangle for Leo.

You could compare the number of items sold across the other clothing categories by comparing the size and shading of each leaf node; larger and darker rectangles mean higher 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.

## Prerequisite

This tutorial uses the Retail Analysis sample PBIX file.

1. From the upper left section of the menubar, select File > Open report.

2. Find your copy of the Retail Analysis sample PBIX file.

3. Open the Retail Analysis sample PBIX file in report view .

4. Select to add a new page.

Note

Sharing your report with a Power BI colleague requires that you both have individual Power BI Pro licenses or that the report is saved in Premium capacity.

After you get the Retail Analysis Sample dataset, you can get started.

## Create a basic treemap

You'll create a report and add a basic treemap.

1. From the Fields pane, select the Sales > Last Year Sales measure.

2. Select the treemap icon to convert the chart to a treemap.

3. Select Item > Category which will add Category to the Group well.

Power BI creates a treemap where the size of the rectangles is based on 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 Men's category has the highest sales and the Hosiery category has the lowest.

4. Select Store > Chain which will add Chain to the Details well to complete your treemap. You can now compare last year's sales by category and chain.

Note

Color Saturation and Details cannot be used at the same time.

5. Hover over a Chain area to reveal the tooltip for that portion of the Category.

For example, hovering over Fashions Direct in the 090-Home rectangle reveals the tooltip for Fashion Direct's portion of the Home category.

## Highlighting and cross-filtering

Highlighting a Category or Detail in a treemap cross-highlights and cross-filters the other visualizations on the report page. To follow along, either add some visuals to this report page or copy the treemap to one of the other pages in this report. The below image the treemap was copied over to the Overview page.

1. On the treemap, select either a Category or a Chain within a Category. That action cross-highlights the other visualizations on the page. When you select 050-Shoes, for example, the visualization shows that last year's sales for shoes was $15,658,108 with Fashions Direct accounting for$2,193,016 of those sales.

2. In the Last Year Sales by Chain pie chart, selecting the Fashions Direct slice, cross-filters the treemap.

3. To manage how charts cross-highlight and cross-filter each other, see Change how visuals interact in a Power BI report.