You are currently viewing How to create a TreeMap in PowerBI

How to create a TreeMap in PowerBI

Loading

In this blog, we’ll learn How to Create a Treemap in PowerBI. Firstly, we have to understand what is it and when should we use it.

Introduction to TreeMap in PowerBI

Treemap is used to visualize hierarchical data through nested rectangle. The size of each rectangle denotes proportional of value of the data points.

Dataset description

In this lesson, we’ll use a supermarket sales dataset that includes order ID, branch, city, customer type, gender, product line, unit price, quantity, tax, total amount, sale date and time, payment method, cost of goods sold (COGS), gross margin percentage, gross income, and buy rating.

You can access the dataset here.

Description: In this dataset, there following features/columns:

Invoice IDUnique Identifier for each Invoice
BranchThere are four branch Site
CityCity where transactions occurred
Customer TypeType of Customer – Member or Normal
GenderGender – Male, Female
Product LineType of Product
Unit PricePrice of a Single Unit of Product
QuantityTotal Quantity of Product Sell in a Single Purchase
Tax 5%5% of Tax on Cost of Goods Sold
TotalTotal Amount of Items without Tax
DateDate of Sale
TimeTime of Sale
PaymentMode of Payment
COGS (Cost of Goods Sold)Total Amount of Items with Tax
Gross Margin PercentageTotal Profit in Percentage
Gross IncomeTotal Profit
RatingRaing of the purchase in range of 1-10

Sample of Data:

Steps to create Treemap in PowerBI

Step1: Open your PowerBI Desktop on your Device

Step2: Click on Get Data button in Home Ribbon and select Text/CSV.

Step3: Open Prompt box will be open to select your text or csv file.

Step4: After selection of dataset, It will pop up a window for Load OR Transform Data. Click on Load to use data on PowerBI.

Step5: In the following picture, data has been loaded successfully.

Step6: Select Treemap from Visualizations Section (Right Hand Side).

Step7: Here, we’ll put the following data (from Sales) in different fields:

Category

Product

Details

Discount

Values

Sum of Total Profit

Step8: Click on Filters (Right Hand Side) to apply some condition.

Step9: Select Product is (All) indicated by red block on Filters.

Step10: Put the values as mentioned in red block.

Note: Filter is used for getting top 5 profitable products. There are lots of things like Format/Style, that can be applied to your visual.

In Visual Section,

  • Colors 🡪 Gaming Laptop = #12239E
  • Colors 🡪 Gaming Console = #E66C37
  • Colors 🡪 Gaming Monitor = #6B007B
  • Colors 🡪 Smartphone = #303037
  • Colors 🡪 VR Headset = #E1C233
  • Category labels 🡪 Values 🡪 Font = Bold

In General Section,

  • Title 🡪 Title 🡪 Text = Top 5 Profitable Product
  • Title 🡪 Title 🡪 Text color = #E6E6E6
  • Effect 🡪 Background 🡪 color = #000000 (Black)
  • Effect 🡪 Visual border 🡪 color = #118DFF (Blue)
  • Effect 🡪 Visual border 🡪 Rounded corners = 10 px
  • Effect 🡪 Shadow = On

Example:

Insights from Treemap

With this Treemap, we are visualizing top 5 profitable products and display at which discount point (0.2, 0.15, 0.1) from dataset.

Top 5 Profitable Products sorted by profit:

Gaming Laptop 🡪 Gaming Console 🡪 Gaming Monitor 🡪 Smartphone 🡪 VR Headset

Conclusion

With Treemap, we can view hierarchical data as a set of nested rectangles, where each rectangle represents a branch of the hierarchy. It helps to understand the structure and distribution of data at different levels of the hierarchy using filters, making it easier to identify trends and insights briefly.

If you like this blog, you can share it with your friends or colleague. You can connect with me on social media profiles like LinkedIn, Twitter, and Instagram.