Power BI: TreeMap Visual

Power BI: TreeMap Visual

·

4 min read

In this blog post, we’ll explore the TreeMap visual in Power BI, show you how to create it, and provide practical examples using a sales dataset. Each example will include results to help you better understand how to use TreeMaps effectively.

What is a TreeMap Visual?

A TreeMap visual displays data as a set of nested rectangles. The size of each rectangle is determined by a measure (e.g., sales revenue), and you can use color to add another layer of insight. TreeMaps are ideal for visualizing part-to-whole relationships and spotting patterns or anomalies in your data.

When to Use a TreeMap?

TreeMaps are best used when:

  • You want to visualize hierarchical data.

  • You need to compare the size of different categories within a single measure.

  • You’re looking for an overview of data distribution and want to highlight large or small segments.

Dataset Overview

Let’s briefly review the dataset (Download it from here) we’ll use for our examples. The dataset contains the following tables:

  • Customers: Contains customer information such as ID, name, gender, country, city, age, and marital status.

  • Products: Holds product details including title, category, unit price, weight, and manufacturer.

  • Stocks: Displays current stock levels for each product.

  • Orders: Captures order transactions including customer ID, product ID, quantity, unit price, and total amount.

How to Create a TreeMap Visual in Power BI

Step 1: Load Your Data

  1. Open Power BI Desktop.

  2. Load your Excel file containing the dataset into Power BI.

  3. Ensure that the data relationships between tables (e.g., Orders and Products) are correctly established.

Step 2: Create the TreeMap

  1. Navigate to the "Report" view in Power BI Desktop.

  2. Select the TreeMap visual from the Visualizations pane.

  3. Drag and drop the fields into the appropriate areas of the visual:

    • Category: This field will define the categories or groups. For example, you can drag Products[Category] here.

    • Values: This field defines the size of the rectangles. For example, you can drag Orders[TotalAmount] here.

Examples

Example 1: Visualizing Revenue by Product Category

Let’s create a TreeMap that shows total revenue by product category.

  1. Category: Drag Products[Category] into the Category field.

  2. Values: Drag Orders[TotalAmount] into the Values field.

Resulting TreeMap:

The TreeMap will display rectangles representing each product category, with the size of each rectangle proportional to the total revenue generated by that category.

Example 2: Comparing Revenue by Country and Product Category

Now, let’s create a more complex TreeMap that compares revenue by both country and product category.

  1. Category: Drag Customers[Country] into the Category field.

  2. Details: Drag Products[Category] into the Details field.

  3. Values: Drag Orders[TotalAmount] into the Values field.

Resulting TreeMap:

This TreeMap will display nested rectangles where:

  • Each large rectangle represents a country.

  • Smaller rectangles within each country represent product categories.

  • The size of each rectangle indicates the total revenue for that category within that country.

Example 3: Analyzing Product Sales by Manufacturer

Let’s create a TreeMap to analyze sales revenue by manufacturer.

  1. Category: Drag Products[Manufacturer] into the Category field.

  2. Values: Drag Orders[TotalAmount] into the Values field.

Resulting TreeMap:

In this TreeMap:

  • Each rectangle represents a manufacturer.

  • The size of the rectangle reflects the total sales revenue from products made by that manufacturer.

Tips for Using TreeMaps Effectively

  • Limit Categories: TreeMaps can become cluttered if you include too many categories. Consider grouping smaller categories into an “Other” category to maintain clarity.

  • Use Color Wisely: Color can be used to add another dimension to your TreeMap, such as indicating performance against a target or highlighting positive and negative values.

  • Combine with Other Visuals: TreeMaps are powerful when combined with other visuals like bar charts or line graphs, allowing for a more comprehensive analysis.

Conclusion

TreeMap visuals in Power BI are a versatile tool for visualizing hierarchical data and comparing part-to-whole relationships within a dataset. Whether you’re analyzing revenue by product category, comparing sales across countries, or evaluating manufacturer performance, TreeMaps provide an intuitive way to identify trends and outliers at a glance.