Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
joshua1990
Post Prodigy
Post Prodigy

COUNT Parent-Child Hierarchy Level

Hi experts!

I have a table that contains two columns:

  • Parent
  • Child

This table demonstrates a multi-level parent-child hierarchy.

Now I would like to determine, how many levels are above and below every combination and if is the last oder lowest "leaf" in the combination.

How would you do that in Power Query?

1 REPLY 1
tackytechtom
Super User
Super User

Hi @joshua1990 ,

 

I actually have just published a blog post providing a suggestion on how to deal with parent-child tables in Power Query. The post still needs some refining, but I thought I'll release it already now, so you can take a glimpse at it. 

 

Depending on how your table exactly looks like, you might actually be able to use the functions in paragraph 3 from this article:

https://www.tackytech.blog/how-to-dynamically-detangle-parent-child-tables-in-power-query/

 

It won't give you exactly what you asked for, but it might provide you with some inspiration on how to fix it yourself.

 

Feel free to provide your parent-child table, if the functions hickup!

 

[Edit]: Here another article that tackles the same issue, but does a better job 🙂
Dynamically flatten Parent-Child Hierarchies in DAX and PowerBI – (thebiccountant.com)

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.