Power BI hierarchies provide you with the drilldown action of the BI report. Let me show you how to create a hierarchy in Power BI reports with an example.
How to create a hierarchy in Power BI
To demonstrate creating hierarchies in Power BI, we'll use the table we created in the article Combine Multiple Tables.


There are a couple of ways to create a hierarchy.
The first approach to creating hierarchy in Power BI
To create a new hierarchy in Power BI, drag and drop one field onto the other. Automatically creates a hierarchy for you. To demonstrate the same in Power BI, we dragged the product subcategory into the product category field.

Now you can see the newly created hierarchy.

The first approach to adding fields to a Power BI hierarchy
Drag and drop the required field into the newly created hierarchy. Let me drag the color field.

You can now see the Color field within the hierarchy.

The second approach to adding fields to a Power BI hierarchy
Select the field you want to add (let me select the product) and right-click on it to open the context menu. Select 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
Be careful when setting the hierarchy levels. For example, if you have the State column above Country, then Level 1 is State and Level 2 is Country.
Select the field in which you want to change the position or level. Then right-click on it and select the Move Up (or Move Down) option from the context menu. Alternatively, drag and drop the field to the required position.

Now you can see the product in the third position.

Rename the hierarchy in Power BI
Select the hierarchy you created and right-click on it to 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 product hierarchy

Now you can see the new name

Delete hierarchy in Power BI
Select the hierarchy you delete and right-click on it to open the context menu. Select the Delete option from the context menu.

Click the Delete button to confirm the delete operation.

The second approach to creating a hierarchy in Power BI
Select the file you want to use in the hierarchy and right-click to open the context menu. Select the New hierarchy option from the context menu.

Create a new hierarchy for yourself.

Let me add a few more fields

Remove fields from the hierarchy
Select the field that you want to remove or remove from the hierarchy. Then right click on it and the Delete option from a context menu.

Click the Remove button to remove the Color field from the hierarchy.

You can see the same in the following screenshot.

Again, we add the Color field and rename the hierarchy as Product Information.
