How to Create Hierarchies in Tableau

How to Create Hierarchies in Tableau

3 mins read3.6K Views Comment
Vikram
Vikram Singh
Assistant Manager - Content
Updated on Mar 20, 2023 12:28 IST

In this article, we will discuss hierarchies in tableau, how to create and remove hierarchies in tableau with examples.

2022_05_MicrosoftTeams-image-229.jpg

Table of Content

Recommended online courses

Best-suited Tableau courses for you

Learn Tableau with these high-rated online courses

โ‚น39.54 K
2 hours
โ€“ / โ€“
45 hours
โ€“ / โ€“
4 weeks
โ€“ / โ€“
4 weeks
โ‚น2.25 K
4 weeks
Free
12 hours
โ€“ / โ€“
1 hours
โ‚น19.89 K
16 hours
โ€“ / โ€“
3 hours
โ‚น19.7 K
6 months

What is Hierarchy in Tableau?

The Hierarchy in Tableau is an arrangement where the entities are presented at various levels.

In common terms, Hierarchy is a system or organization that has many levels from highest to lowest; similarly, in Tableau, we can create hierarchies by bringing one dimension as a level under the principal dimension.

Still confused!!!

So, letโ€™s understand by an example:

Example1:

In the Sample Superstore dataset, the Hierarchy for geographical dimensions is:

  • Country (USA)
  • Region (Centre, East, West, South)
  • State
  • City
  • Postal Code

If you want to deliver any product, then you must have geographical locations.

So, it will be good practice if we drill down the location as the above.

Letโ€™s take another example of Hierarchy from the same sample of Superstore data:

Example2:

We can create the Hierarchy for the order date as follows:

  • Year
  • Quarter
  • Month
  • Day
  • Week Number
  • Weekday

If we use the above Hierarchy, it will be very easy to track the order or shipment.

Must Check: What is Tableau?

Must Check: Tableau Online Courses & Certifications

How to create a Hierarchy in Tableau?

Creating hierarchies in Tableau is very easy, and it can be done in just one step:

  • In the data pane, drag a field and drop it directly onto the another field
    • Create Hierarchy dialog box will appear
    • Enter the Name
    • Click OK

Note: You can also add other fields in the above Hierarchy and then can re-order them as required by simply dragging them to a new position.

Letโ€™s take an example to understand how to create a tableau:

Example 3: We will create a geographical hierarchy using Sample Superstore data as discussed in example 1.

Steps to create Hierarchy

  • Connect to Sample Superstore data
  • In the Data pane, drag a Region, and drop it directly to Country
    • Create Hierarchy dialog box will appear 
    • Change Name to Geographical Location
2022_05_create-hierarchy.jpg
  • In the data pane, a new hierarchy is created, as seen below:
2022_05_drag-and-drop-region-in-country.jpg
  • Drag and Drop State, City, Postal Code to Geographical Location
2022_05_drag-and-drop-region-city-postal-code.jpg
  • Re-order fields in the Hierarchy to the required positions
2022_05_rearrange-the-order.jpg

What Next???

We have created the geographical Hierarchy in the data pane, and now we will add the Hierarchy to the visualization. 

From there, we can quickly drill up or down in the Hierarchy to add or subtract more levels of details.

How to Create Group in Tableau
Sort Data in Tableau
Connecting data in Tableau

Drill up or down in a Hierarchy

Similar to creating Hierarchy, it is very easy to drill up or down in Tableau during visualizations.

It is as simple as:

  • Clicking the + or โ€“ icon on the hierarchy field
    • + for drill-down
    • โ€“ for drill-up

Letโ€™s see with an example:

Example 4: We will use the same Hierarchy created in the above example( example 3)

Steps to Drill down:

  • Drag and drop Profit in Column Shelf
  • Drag and Drop Country/Region in Row Shelf
2022_05_drill-up-or-down-country.jpg
  • Click on + icon next to Country/Region field
    • In the row shelf, next to the Country/Region field, you will get Region
2022_05_drill-down-1.jpg
  • Similarly, If you click + icon next to the Region field
    • You will get State field
2022_05_drill-down-2.jpg

Steps to Drill Up:

  • Click on the โ€“ icon next to Region
    • State field in visualization is removed
2022_05_drill-down-1.jpg
  • Similarly, if you click โ€“ next to Country/Region
    • The Region field in the visualization is removed
2022_05_drill-up-or-down-country.jpg
Tableau Operators: Arithmetic, Comparison and Logical
How to Create Sets in Tableau
Dimension and Measure in Tableau

Remove a Hierarchy

To remove a hierarchy in Tableau:

  • In the data pane
    • Right-click on the hierarchy
    • Select Remove Hierarchy
2022_05_remove-hierarchy.jpg

The field in the Hierarchy is removed from the Hierarchy, and it will disappear from the data pane.

Conclusion

In this article, we have discussed hierarchies in tableau, how to create and remove hierarchies in tableau with examples.

Hope this article will help in your data analysis journey.

Top Trending Articles:

Data Analyst Interview Questions | Data Science Interview Questions | Machine Learning Applications | Big Data vs Machine Learning | Data Scientist vs Data Analyst | How to Become a Data Analyst | Data Science vs. Big Data vs. Data Analytics | What is Data Science | What is a Data Scientist | What is Data Analyst

About the Author
author-image
Vikram Singh
Assistant Manager - Content

Vikram has a Postgraduate degree in Applied Mathematics, with a keen interest in Data Science and Machine Learning. He has experience of 2+ years in content creation in Mathematics, Statistics, Data Science, and Mac... Read Full Bio