An on-line library for creating different chart types in Tableau

Tree Map

Tableau Canvas Layout:

The treemap is an odd chart to create in Tableau. It does not have a pill on the Rows or Columns, everything is done on the Marks Card.

Data Set: Sample World Indicator Dataset

Building a Tree Map

Open "World Indicators" data in Tableau:

     Move Region to Color
     Move Country to Details
     Move Population Total to Size and make sure the Measure is SUM
     Add Year to Filters and select 2012. This will filter the data to a single year.

You now have a basic treemap like below. You can move Country or Population Total to Label if you would like to have the countries and population of each country listed in the treemap.

Building Level of Detail in Tree Map

Step 1: Create a new parameter

   Parameter Name: Select Region
   Data Type: String
   Allowable Values: List
   Select Add from Field and select Region
   Once the values for the Regions are filled in, add All and None to the list.
   Select OK.
   Right-click on the new parameter and select Show Parameter.

Step 2: Create Calculated Field

   Calculated Field Name: Detail Level
   if [Select Region] = [Region] then [Country]
   elseif [Select Region] = 'All' then [Country]
   else [Region]

Step 3: Use the New field Detail Level in place of Country

Now we can view the map at different levels of detail:
If All is selected then it will be at the lowest level of detail - Country.
If None is selected then it will be at the highest level of detail - Region.
If any of the Regions are individually selected then it will use the Country for that selection and Region for everything else.

Related Blog Posts:

Using Treemaps to Visualize Data by Jeffrey Shaffer

Return to the chart gallery