I have a following data set based on VSTS Task, User Story, Feature, Epic hierarchy
Id | Parent ID | Hours completed | Aggregated hours
1 | |
2 | 1 |
3 | 2 | 3
4 | 2 | 4
5 | 1 |
6 | 5 | 2
7 | 5 | 5
I want to calculate for each row what is the aggreagated hours calculated as a sum of all its children. That means, I want to know how many hours have been spent per user story, per feature, per epic.
Id | Parent ID | Hours completed | Aggregated hours
1 | | | 15 (3+4+2+6)
2 | 1 | | 7 (3+4)
3 | 2 | 3
4 | 2 | 4
5 | 1 | | 8 (2+6)
6 | 5 | 2
7 | 5 | 6
I tried to denormalize the hierachy, so I would have a hierarchy level as a column based on https://www.daxpatterns.com/parent-child-hierarchies/
Id | Parent ID | Level 1 | Level 2 | Hours completed | Aggregated hours
1 | | | | | 15 (3+4+2+6)
2 | 1 | 1 | | | 7 (3+4)
3 | 2 | 1 | 2 | 3
4 | 2 | 1 | 2 | 4
5 | 1 | 1 | | | 8 (2+6)
6 | 5 | 1 | 5 | 2
7 | 5 | 1 | 5 | 6
But this got me nowhere... Is there a way to achieve this in Power BI? Tried a SUMX but still far from the correct results
EstCumulativeHoursCompleted =
CALCULATE(
SUMX('Work Items - Today', 'Work Items - Today'[Completed Work]),
'Work Items - Today'[Parent Work Item Id] = EARLIER('Work Items -
Today'[Work Item Id])
)
Thanks for some hints!
P.S. Based on suggestion from Alexis, I mananaged to get this: