Power BI Hierarchies provides you with the drill down action to the BI report. In this article, we will show you, How to Create hierarchy in Power BI reports with an example.
How to Create Hierarchy in Power BI
To demonstrate the creation of hierarchies in Power BI, we are going to use the table that we created in the Combine Multiple Tables article.
There are a couple of ways to create a hierarchy in power bi
The first approach to Create Hierarchy in Power BI
In order to create a new hierarchy in Power BI, Drag and drop one field on to the another. This will automatically create a Hierarchy for you. To demonstrate the same, we are dragging the product subcategory onto the product category field.
Now you can see the newly created hierarchy.
The first approach to add fields to a Power BI hierarchy
Drag and drop the required field to the newly created hierarchy. Let me drag the color filed.
Now you can see the Color field inside the Hierarchy.
The second approach to add fields to a Power BI hierarchy
Please select the field that you want to add (let me select product), and right-click on it will open the context menu. Select the Add to Hierarchy, and then select the Hierarchy name (Product Category Hierarchy)
Now you can see the Product under the hierarchy.
Change Hierarchy Levels in Power BI
Please be careful while configuring the hierarchy levels. For instance, if you have the State column above the Country then Level 1 will be state, level 2 will be Country.
Please select the field that you want to change the position or level. Next, right-click on it and select the Move Up option (or move down) from the context menu. Alternatively, you drag and drop the field at the required position.
Now you can see the product at the third position
Rename Hierarchy in Power BI
Please select the Hierarchy that you created, and right-click on it will open the context menu. Select the Rename option from the context menu. Alternatively, you can double-click on the hierarchy name
Let me rename it as the product hierarchy
Now you can see the new name
Delete Hierarchy in Power BI
Select the Hierarchy that you delete, and right-click on it will open the context menu. Please select the Delete option from the context menu.
Click on the Delete button to confirm the delete operation.
The second approach to create Hierarchy in Power BI
Please select the filed that you want to use in Hierarchy, and right-click on it will open the context menu. Select the New Hierarchy option from the context menu.
This will create a new hierarchy for you.
Let me add a few more fields
Delete Fields from Power BI Hierarchy
Please select the field that you want to remove or delete from the hierarchy. Next, right-click on it and Delete option from a context menu.
Click the delete button to delete the Color field from the hierarchy.
You can see the same
Again, we added the Color field and renamed the hierarchy as the Product Information.