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]

Create Tableau Treemap using Marks Shelf

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. Next, Drag and Drop the SalesAmount from the Measures Region to the Size Field in the Marks card.

Now you can see the available State names and their sales in the Tableau report. For more Charts, Click Here.

Add State Dimension to Label and Sales Measure to Size

By default, Desktop displays Tableau 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.

Next, please add the Profit to the Color shelf to change the color of each box based on the profit. To get this result, create a Calculated field and write the below expression.

Profit = [SalesAmount] - ([TotalProductCost] + [TaxAmt] + [Freight])
Tableau Treemap

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 Sales to Size and State to Labels

Add and format Colors to the Treemap

The above screenshot shows a profit calculated field on the color shelf. Let us format the color of the Tableau Treemap by clicking the Edit Colors button on the Marks shelf. Next, choose the palette that suits your requirements.

Change the Color Palette

Once you complete it, the following screenshot will display. The state name Box with Maximum Sales will be filled with Dark Green and the Least Sales Amount with Red.

Tableau Treemap with Unique Colors

Tableau Treemap text format

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

Format Labels

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

Format the Tableau Treemap Label font, color

See the Formatted Text in the Tableau Treemap.

Tableau Treemap with format Data Labels ad Text

Create a Tableau Treemap using the Show Me window

Please press and hold the control (command) key, select the Dimension (s) and Measure(s) from the respective region, and select the Treemap from the Show Me window. So, let me choose the StateProviceName and SalesAmount and hit the treemap.

Use Show me window

Once completed, the desktop will create this for you.

Tableau Treemap from the Show Me window

Instead of creating a single treemap, Tableau also allows you to create multiple ones, as shown below. To create the same, drag and drop the Color Dimension to the Rows Shelf and add Profit to the Color Shelf.

As you can see from the below screenshot, each color has its own treemap and each portion of the treemap is subdivided into states.

Tableau Treemap 11

As there are few colors with zero slaes, so let me Group the Multi, NA, White, and Blue Colors. To do so, use Control, select the Columns, and choose the Group option.

Tableau Treemap 12

Let me change the Font to show you more labels. Next, add SalesAmout to the Label shelf to see the sales along with state names.

Tableau Treemap 13

Comments are closed.