Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I have a parent-child hierarchy table. I don't know in advance how many levels there are.
I need help with building a function that would flatten the levels.
I found this very helpful post:
https://pivotalbi.com/dynamically-flatten-a-parent-child-hierarchy-using-power-query-m/
It does everything. But it leaves "low" levels empty if the hierarchy is not longest.
So I basically ask for your help altering some M code to fill the empty values with the values from level above.
Here is a Power BI file
https://1drv.ms/u/s!AoP_9ampPIT7gdFtb4M-04m-1Z6JgQ?e=9EIk25
Thanks
Solved! Go to Solution.
I've solved it with a help of @LivioLanzo solution to this post.
https://community.powerbi.com/t5/Desktop/Parent-Child-Hierarchy-Highest-Parent-using-Power-Query-not...
It's dynamic, not fixed solution.
Hey how do you integrate/ define relationship between actual table data and this data in the bi visuals.
I had a data table which had parentid and childid, I used this and created the levels and added it to slicer now I want my visual to show me data related to only the selected childid or group id.Any idea on this
You are not just flattening the hierarchy - you are also forcibly converting it from ragged to fixed depth. Doing that with repetitions of values is generally frowned upon. While the function you mentioned could be modified that would include a second run to identify the maximum level of depth before you would then traverse the hierarchy. I don't think it is a good idea. What's the next step?
Note that Power Query producing variable output is asking for trouble. Your downstream processes (Power BI Meta data) will break.
I've solved it with a help of @LivioLanzo solution to this post.
https://community.powerbi.com/t5/Desktop/Parent-Child-Hierarchy-Highest-Parent-using-Power-Query-not...
It's dynamic, not fixed solution.
User | Count |
---|---|
86 | |
82 | |
68 | |
66 | |
55 |
User | Count |
---|---|
123 | |
100 | |
90 | |
83 | |
66 |