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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Summarizing / aggregating in parent-child hierarchies

Hi, I'm trying to make a report with a slicer that shows employee headcount plan for departments. There are many departments in different hierarchies.

 

My "headcount plan" table looks like this:

 

DEPIDDepartment NameParent IDParent PathHeadcount Plan
1IT1115
2IT - Web Development11 | 27
3Finance3325
4HR44

17

5HR - Training44 | 5

5

6HR - Strategy44 | 6

12

 

The slicer I have shows departments in a hierarchical fashion. There are 4 levels in the hierarchy. I used a PATHITEM DAX measure to flatten the hierarchy, which I use for the slicer.

 

When I just sum all of the Headcount Plan using SUM(Table[Headcount Plan]), it sums child values on top of the parent values, leading to inaccuracy and added values. I want to show it as a card that changes its value upon a filter is applied.

 

How would one aggregate the Headcount Plan column without summing child values on top of parent values?

 

Please let me know if clarifications are needed.

 

Thank you.

 

 

1 ACCEPTED SOLUTION
HoangHugo
Solution Specialist
Solution Specialist

Hi, I understant you want to SUM the parent deparment without child deparment. And child departments  have "|" in its parent path, so I will use it to remove child departments.

 

Measure = CALCULATE (SUM(Headcount plan),SEARCH("|",parent path column,1,blank())=BLANK())

View solution in original post

1 REPLY 1
HoangHugo
Solution Specialist
Solution Specialist

Hi, I understant you want to SUM the parent deparment without child deparment. And child departments  have "|" in its parent path, so I will use it to remove child departments.

 

Measure = CALCULATE (SUM(Headcount plan),SEARCH("|",parent path column,1,blank())=BLANK())

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 MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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