/    /  Tableau Hierarchies

 

What are Hierarchies in Tableau?

Prior to learning how to create hierarchies in Tableau, let me provide a brief overview of hierarchies. Tableau is not the only place where the term hierarchy is used, and you might have heard and used it before.

Data hierarchies are logical arrangements of relevant unique attributes within a data set. Data fields are arranged in hierarchies by level, such as regions, countries, states, cities, and areas in the case of a geography hierarchy. In a Time hierarchy, the levels are year, month, week, and day.

We organize our data by creating hierarchies in Tableau. Hierarchies can be automatically created by Tableau by detecting relevant fields or they can be manually created.

Creating Hierarchies in Tableau

To create hierarchies in Tableau, follow the steps below.

Step 1: The Tableau Hierarchy can be accessed by dragging a field

In order to begin creating a hierarchy in your data set, select a field from the list of dimensions and measures. Drag the field onto or over another field by selecting and holding it. As a result, we have added a field at a subordinate level of the hierarchy.

You may also add a field to an existing hierarchy by right-clicking on the field name and selecting Hierarchy from the menu. Select the Add to hierarchy option and select the hierarchy to which the field should be added.

h1

Step 2: Name the Hierarchies in Tableau

Whenever you add a field on top of another field, a window appears where you must enter the hierarchy’s name. The hierarchy should be named appropriately and then clicked on OK.

2

Step 3: Adding More Fields in Tableau Hierarchy

As shown in the screenshot below, once you enter a name, the hierarchy can be viewed on the left Data panel. The Sub-category field is located under the Category field. Thus, Category is on the first level of the hierarchy and Subcategory is on the second level. In step 1, you can add more fields under a field in a hierarchy.

h3

Step 4: Drill Down Hierarchy in Tableau

In order to visualize this hierarchy, you can place it in a Rows or Columns section. Click on the plus (+) sign next to a field name to drill down in the hierarchy. As shown in the screenshot below, our field Category is at the top of the hierarchy. A field on a lower level in the hierarchy will be displayed when we click on the + sign near the field name.

h4

Step 5: Analyze Data in Tableau Hierarchy

The field Sub-category and its contents are now also visible in the bar chart, as shown in the screenshot below. This is the result of drilling down one level in the hierarchy. Click on the minus – sign present near a field name to return to the top or preceding field. This allows you to view and analyze data at different levels of detail by drilling up and down the hierarchy.

h5

Step 6: Geo Hierarchy in Tableau

As shown in the screenshot below, a geohierarchy with the name Geography has been created. Subsequently, there are fields at sub-levels such as Region, Country, State, City, etc.

h6

How to Remove a Hierarchy in Tableau?

In Tableau, you can remove a hierarchy by right-clicking on the hierarchy name (present in the Data pane) and selecting Remove Hierarchy. The Data pane will no longer display the name of the hierarchy after this action has been taken to remove all the fields from it.

Thus, By following the steps mentioned above we can create and remove a hierarchy in Tableau