Tableau Treemap

The tableau Treemap is used to represent the data in Rectangle Boxes. We can determine each rectangle box using any of our Dimension members and the box size by Measure value. Tableau Treemap is very useful for displaying the most massive data set information in a small data region.

In this article, we will show you how to Create Tableau Treemap, and the SQL Query for this is

SELECT Geo.EnglishCountryRegionName, 
       Geo.StateProvinceName, 
       Geo.City, 
       Prod.EnglishProductName, 
       Prod.Color, 
       Fact.OrderQuantity, 
       Fact.TotalProductCost, 
       Fact.SalesAmount, 
       Fact.TaxAmt, 
       Fact.[Freight]
FROM DimProduct AS Prod 
   INNER JOIN FactInternetSales AS Fact 
      ON Prod.ProductKey = Fact.ProductKey 
   INNER JOIN DimSalesTerritory AS Terry 
      ON Terry.[SalesTerritoryKey] = Fact.[SalesTerritoryKey] 
   INNER JOIN DimGeography AS Geo 
      ON Geo.[SalesTerritoryKey] = Terry.[SalesTerritoryKey]

First Approach to Create Tableau Treemap

In this example, we create a Tableau Treemap for the State dimension against the Sales Amount size. First, Drag and Drop the State Dimension from Dimension Region to Text Field in the Marks card.

Now you can see the available State names in the Tableau report

All the names or Text inside a Report

Next, Drag and Drop the Sales from the Measures Region to Size Field in the Marks card.

Add Size Field in Marks card to change the text sizes

By default, Desktop displays TreeMap with State Name as a rectangle Text field and Sum of Sales Amount as the Box size. As you can observe, the Box Size of California State is larger than the remaining states because the Sales Amount is higher than in other states.

Add Sales to Size and State to Labels 3

Let us add color to the Tableau Treemap by dragging the Calculated field Profit to the Colors field in Marks Shelf.

Add Profit or Measure value to Color shelf 4

Once you complete it, the following screenshot will be displayed. State name Box with Maximum Sales will fill with Dark Green and Least Sales Amount with light green.

Tableau Treemap 5

Let us add SalesAmount and Profit values to the Text field as well. You can see the State name along with the Sales Amount and Profit. To do this, Please drag the Sales and Profit from the Measures region to the Text field in Marks Shelf.

Add Values to text Field

Tableau Treemap text format

To format the Treemap Data Labels, click on the Text field inside the Marks Shelf to open the window below. For now, we are doing basic formatting so click on the … the button beside the text.

Select labels and click browse button for Text Format 7

Here, we added extra text Sales, Profit beside the < SUM(SalesAmount) > and < SUM(Profit) > and also changed the font style to Lucida Sans.

Format Text in Edit Labels Window

See the Formatted Text in the Treemap.

Tableau Tree map 9

Create a Tableau Treemap example 2

Please press and hold the control key, select the Dimension (s) and Measure(s) from the respective region, and select the Treemap from the Show Me window.

Tableau Treemap 1

Once completed, the desktop will create this for you.

Tableau Treemap 2

Comments are closed.