Skip to main content

Ragged hierarchy in Power BI


Case- I have a data set which has to be visualized in a ragged hierarchy.


What is ragged hierarchy

A ragged hierarchy is a user defined hierarchy with an uneven number of levels. You can see the above table which has 5 levels of hierarchy. In the first level we only have “World” as a category then moving forward to the next level we have two categories  namely “UK” and “USA” likewise the level of hierarchy is drilling down up to five levels with an uneven amount of categories.

Creating a hierarchy in Power BI



In the above image  you can notice that I have right clicked the “level 1” column which has to be the first level of our hierarchy, Once it is right clicked there you will notice “New hierarchy” as the second option then you will have to click that in order to create a new one.



As you can notice in the above image once I have created a new hierarchy then a new column is created named “Level 1 Hierarchy” in that I have dragged and dropped all the other columns belonging to that hierarchy.

Problem with the default slicer

In order to do this I tried the default slicer option but it didn’t allow me to have multiple columns for a ragged hierarchy. So if we try to include our newly created hierarchy then it will only consider the “Level 1” column and will give “World” as the only slicer selection as shown below.


Including the hierarchy in a hierarchy slicer

In order to complete my need I was able to find a custom visual named “Hierarchy Slicer”. So you need to add that “From Store” you can find the store from the task bar and search for the above mentioned visual and it’s shown below.


You need to add this visual from the store, once you have added this then select it from your visuals and drag and drop the hierarchy that we have created on the field of this visual then it will give you something like I have shown below.


Can you notice that all the columns that I have included in the hierarchy has been included in the visual, also you can see that it is allowing me to drill down through each level.

Solving the blank issue in the ragged hierarchy

Once you have created the “slicer hierarchy visual” you should go to the format option which is right next to the field and there you have “Selection” as first option then you need to turn off the “Empty Leafs” as shown below in order to get rid of all the blank values in the ragged hierarchy.


Conclusion

Ragged hierarchy is used depending on user needs and Power BI allows us to visualize it using the custom visual “Hierarchy Slicer” also it allows us to get rid of blanks which makes the slicer look untidy.





Comments

  1. I really appreciate information shared above. It’s of great help.
    Microsoft Power BI Online Training

    ReplyDelete
  2. This dose not work when you want to display data in a matrix. Check out the post I just made on how to solve this issue for matrices.

    https://community.powerbi.com/t5/Desktop/Ragged-hierarchy-Visualization/m-p/162892/highlight/false#M70953

    Best,

    ReplyDelete

Post a Comment