Creating Hierarchies in Tableau

Hierarchies can help us to group our fields together, making our data source easier to understand and drill down. This can be used within different field types, with this blog focusing on geographical measures from the superstore data set.

We can see in our discrete fields that the geographical data has been separated by Country/Region, Region, State, City, and Postal Code. These are fields that we would want to be able to drill down in our analysis, and would therefore work well in a hierarchy. To create this, we want to drag our Region field into Country/Region in the discrete measures pane, and should see a Create Hierarchy message pop up. We are moving Region into Country as the Region field would be a breakdown of the Country, just as the State would be a breakdown of the Region.

This pop up will allow us to name the hierarchy, and in this case we can call it location to summarize the fields we will be using. Next we want to click and drag State, City, and Postal Code into this hierarchy. The order isn't too important at this point as we can change it once the fields have been dragged in. The order will be going from the biggest to the smallest breakdown, and in this case that will be Country -> Region -> State -> City -> Postal Code. If we want to move the measures in this hierarchy, all we need to do is click and drag the measures into the order we want them (a black line should appear when moving the measures around).

Now if we use this data in Tableau, we can click on the + next to the measure to see our drill down action. In the example below, we can map the sum of sales to the colour field for the Country, and then drill this down to a Postal Code level. This will work regardless of the graph type, and should make the data source easier to manage and explore.

Some good practise for this would be to arrange the categories into hierarchies, as they could benefit from an easy drill down action.

Author:
James Driver
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab