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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
k_rahul_g
Frequent Visitor

Multi level parent child hierarchy summarization

In a hierarchical table "BaseData" , I have to summarise an attribute "timespent" for all LEVELS of child work item. the problem is that the parent (where it need to be summarize) could also be a child of another workitem ( this is where Pathcontains might fail - dont suggest that please.)
The table is fully flattend table going upto 9 levels.


I have follwoing columns 

Workitem
Workitemtype ("Program Epic", SWApproval, Defect, Story, Work and Review, Task)
Path ( this is generated using DAX path function)
Level1
Level2
level 3 ..... Upto level 10. ( each level will be represented as an idependent workitem )
TimeSpent ( this is what i need to summarize)

Some Cases - Program EPIC-> Defect-> Story -> Task
OR
Defect-> Story->Work& Review-> Task
OR
Program Epic -> Program Epic -> Defect -> Story-> Task
OR
Program EPIC-> SWApproval-> Story -> Task

I want only the sum of child ( All levels) for a workitem type "SWApproval" going recursively in the table or using the flattened hierarchy.

The SWApproval could appear at any level and have children (grand children) workitems. 

 

Here is sample data. 

workItemIDworkItemTypetimespentestimatePathPathLengthLevel1Level2Level3Level4Level5Level6Level7Level8Level9Level1_categoryLevel2_categoryLevel3_categoryLevel4_categoryLevel5_categoryLevel6_category
72935Work and Review161653705|58010|69131|69689|7293555370558010691316968972935    Program EpicSWApprovalStoryWork and ReviewWork and Review
73180Work and Review0.5899418|97842|72103|72104|7318059941897842721037210473180    Program EpicSWApprovalProgram EpicStoryWork and Review
73357Work and Review202053705|58010|69131|69689|7335755370558010691316968973357    Program EpicSWApprovalStoryWork and ReviewWork and Review
73460Work and Review04595083|21464|32549|32844|7346059508321464325493284473460    FeatureProgram EpicStoryTaskWork and Review
74293Work and Review7414453705|58010|69131|69689|7429355370558010691316968974293    Program EpicSWApprovalStoryWork and ReviewWork and Review
74435Work and Review404099418|97842|72127|72128|7443559941897842721277212874435    Program EpicSWApprovalProgram EpicStoryWork and Review
74436Work and Review404099418|97842|72127|72128|7443659941897842721277212874436    Program EpicSWApprovalProgram EpicStoryWork and Review
74437Work and Review323299418|97842|72127|72128|7443759941897842721277212874437    Program EpicSWApprovalProgram EpicStoryWork and Review
74439Task161699418|97842|72127|72128|74436|744396994189784272127721287443674439   Program EpicSWApprovalProgram EpicStoryWork and ReviewTask
74440Task8899418|97842|72127|72128|74436|744406994189784272127721287443674440   Program EpicSWApprovalProgram EpicStoryWork and ReviewTask
74441Task323299418|97842|72127|72128|74436|744416994189784272127721287443674441   Program EpicSWApprovalProgram EpicStoryWork and ReviewTask
74463Work and Review404099418|97842|72091|72092|7446359941897842720917209274463    Program EpicSWApprovalProgram EpicStoryWork and Review
74484Task04099418|97842|72121|72122|74491|744846994189784272121721227449174484   Program EpicSWApprovalProgram EpicStoryWork and ReviewTask
74485Task01699418|97842|72121|72122|74489|744856994189784272121721227448974485   Program EpicSWApprovalProgram EpicStoryWork and ReviewTask
74489Work and Review04099418|97842|72121|72122|7448959941897842721217212274489    Program EpicSWApprovalProgram EpicStoryWork and Review
6 REPLIES 6
ImkeF
Super User
Super User

Hi @k_rahul_g ,
if you need your table unmodified, you can use this approach: 
Parent-Child Hierarchies with multiple parents in Power BI with Power Query (thebiccountant.com)
It works with multiple parents as well.
Please check file enclosed.

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Syndicate_Admin
Administrator
Administrator

 I tried using th path function and it gives erros that  every workitem (i.e. Parent) should also appear as the child in the table.  

If you examine my Power Query code you will see that this is taken care of.

Syndicate_Admin
Administrator
Administrator

A child cannot have two parents in a hierarchy  (as opposed to IRL) so ignoring the parent entries for 23156 and 13329. Next we need to fill the gaps for childless parents.  Then you can use the PATH functions for your rollups.

 

I'll leave the next step to you.

Your solution, I believe is eliminating some data, which is something I would like to avoid. 

 

The table would always have a childless parents. As there would  be node levels. This can not be eliminated. I tried using th path function and it gives erros that  every workitem (i.e. Parent) should also appear as the child in the table.   

My data would not have this established as there would be workitems that are in analysis and have not been divided into further tasks or stories.  

Hence looking for another work arond. 

 

and while giving sample data i  made that mistake of multiple parents to a child. This is not the scenario in actual data. A child would have 1 parent only.  but a parent would have multiple levels of children. 

Syndicate_Admin
Administrator
Administrator

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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