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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
k_rahul_g
Frequent Visitor

Adding a summary column for parent at multlevel Hierarchy

Hi, I have a power BI table  (BaseData) with columns as 

WorkItemID, WorkItem Type,  ParentID, Path (created using Path Function) , Effort Esitmate, Effort Spent. 

 

for Simplicity, I have added another table (Parent_Child) that has just 2 columns - Parent ID and Child ID ( both referrring to workitems in parent table)

 

I want to add a column at workitem level, that goes recursively in the hierarchy and adds effort values for all child workitems. 

 

I know it can be done using "PathContains" function, but due to large size of the dataset, powerBI just hangs before the calculation is completed. 

 

sample Data 

workItemIDParentIDworkItemTypeTask CategoryPathCategory_Path_Total Estimate_Total Effort
10208532963Task 3465|32963|102085Program Epic | Story | Task |  |  |  |  |  | 1616
10208732963Task 3465|32963|102087Program Epic | Story | Task |  |  |  |  |  | 3232
10233732963Task 3465|32963|102337Program Epic | Story | Task |  |  |  |  |  | 3232
10234032963Task 3465|32963|102340Program Epic | Story | Task |  |  |  |  |  | 88
10285932963Task 3465|32963|102859Program Epic | Story | Task |  |  |  |  |  | 88
10286632963Task 3465|32963|102866Program Epic | Story | Task |  |  |  |  |  | 2424
10286732963Task 3465|32963|102867Program Epic | Story | Task |  |  |  |  |  | 1616
10286832963Task 3465|32963|102868Program Epic | Story | Task |  |  |  |  |  | 2424
10287032963Task 3465|32963|102870Program Epic | Story | Task |  |  |  |  |  | 2424
10400932963Task 3465|32963|104009Program Epic | Story | Task |  |  |  |  |  | 16
10401032963Task 3465|32963|104010Program Epic | Story | Task |  |  |  |  |  | 1616
10401532963Task 3465|32963|104015Program Epic | Story | Task |  |  |  |  |  | 2424
10401632963Task 3465|32963|104016Program Epic | Story | Task |  |  |  |  |  | 2424
10401832963Task 3465|32963|104018Program Epic | Story | Task |  |  |  |  |  | 3232
10582532963Task 3465|32963|105825Program Epic | Story | Task |  |  |  |  |  | 2424
10582632963Task 3465|32963|105826Program Epic | Story | Task |  |  |  |  |  | 3232
10582832963Task 3465|32963|105828Program Epic | Story | Task |  |  |  |  |  | 2424
10582932963Task 3465|32963|105829Program Epic | Story | Task |  |  |  |  |  | 2424
10710732963Task 3465|32963|107107Program Epic | Story | Task |  |  |  |  |  | 2424
11174132963Task 3465|32963|111741Program Epic | Story | Task |  |  |  |  |  | 2424

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @k_rahul_g - Ensure that your BaseData table and the Parent_Child table have the necessary relationship based on the WorkItemID and ParentID. This will help DAX understand the hierarchy.
Recursive Summation Using a Measure the Effort Esitmate across all child work items:

 

Total Effort Recursive =
VAR CurrentWorkItem = MAX(BaseData[WorkItemID])
VAR ChildEfforts =
CALCULATE (
SUMX (
FILTER (
BaseData,
BaseData[ParentID] = CurrentWorkItem
),
[Effort Estimate]
)
)
VAR RecursiveChildEfforts =
CALCULATE (
SUMX (
FILTER (
Parent_Child,
Parent_Child[Parent ID] = CurrentWorkItem
),
[Total Effort Recursive]
)
)
RETURN [Effort Estimate] + ChildEfforts + RecursiveChildEfforts





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @k_rahul_g - Ensure that your BaseData table and the Parent_Child table have the necessary relationship based on the WorkItemID and ParentID. This will help DAX understand the hierarchy.
Recursive Summation Using a Measure the Effort Esitmate across all child work items:

 

Total Effort Recursive =
VAR CurrentWorkItem = MAX(BaseData[WorkItemID])
VAR ChildEfforts =
CALCULATE (
SUMX (
FILTER (
BaseData,
BaseData[ParentID] = CurrentWorkItem
),
[Effort Estimate]
)
)
VAR RecursiveChildEfforts =
CALCULATE (
SUMX (
FILTER (
Parent_Child,
Parent_Child[Parent ID] = CurrentWorkItem
),
[Total Effort Recursive]
)
)
RETURN [Effort Estimate] + ChildEfforts + RecursiveChildEfforts





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Kudoed Authors