Tableau Hierarchy provides drill-down action to the Tableau report. With the help of tiny + and – symbols, we can navigate from a higher level to a nested level or lower level.
For this Tableau hierarchies example, we are going to use the Data Source we created in our previous article. So, Please visit Data Labels in Tableau Reports article to understand the Tableau Data Source.
How to Create hierarchies in Tableau
Select and Right Click on the Dimension name, on which you want to create a hierarchy in Tableau. Please select the hierarchy option and then select create hierarchy option from the context menu
Once you selected the create hierarchy option, a new pop up window will be opened to rename the hierarchy name as shown below. For now, we are renaming it as Country
Once you click OK button, you can see the newly created hierarchy name with English Country Region Name member
There are multiple ways to add members to hierarchies in tableau.
Approach 1 to add a member to Hierarchies in Tableau
The first method, Drag and drop the required dimension to the newly created hierarchy in Tableau. While dropping, it will show a horizontal line representing the member position.
For instance, if you drop the State column above the Country name, then State is at Level 1, level 2 will be Country (Country will nest inside the state), which will give a strange result. So, Please be careful while dropping the members
Once you completed, a newly dragged member will display in the Country hierarchy
Approach 2 to add a member to Hierarchies in Tableau
Select and Right Click on the Dimension name, which you want to add to the existing hierarchy in Tableau. Please select the hierarchy option then Add to hierarchy option and then select the hierarchy name from the context menu
Once completed, Our dimension will add to the Country hierarchy. Similarly, we added Postal code as shown below
When you add the Country name, from the below screenshot, you can notice the tiny + symbol beside the country name. This symbol will allow performing drill down action
When you expand the Country Region name, Tableau report will display the Sum of Sales Amount for every state present in the countries
When you expand the State name, Tableau report will show the Sum of Sales amount for the current City
We can further drill down the tableau report by expanding the City. When you expand the City name, Tableau report will display the Sum of Sales Amount for every postal code
Approach 2 to Create hierarchies in Tableau
Drag one member on to the other will automatically create hierarchies in tableau. In this example, we drag state member on to the Country name as shown below
when you drag state member on to the Country name, a new pop up window will be opened to rename the hierarchy name as shown below. For, we are renaming it as Country
Once you click the OK button, you can see the newly created hierarchy name with Country Name, State Province Name members. Similarly, we can add many more.
NOTE: When you add more members while dropping, it will show a horizontal line representing the member position. Please be careful while dropping the members
Remove members from Hierarchies in Tableau
Removing the Tableau Hierarchy member is very easy. To do so, select and Right Click on the Hierarchy member, which you want to detach or remove from the hierarchy in Tableau. Please select the hierarchy option and then Remove from hierarchy option from the context menu
Once you chose the Remove from Hierarchy option, Postal Code member will detach or remove from the Tableau hierarchy. You can notice the same from below screenshot
TIP: To remove members from Tableau hierarchies, we can drag members from hierarchy to the dimension pane.