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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Mohamedali
New Member

Child / Parent Relationship Count and Hierarchy Build

Good Morning, 

I am hoping you can help me.

i am not sure how to describe my problem statement but hopefully with the attached and examples it will make sense 

In my dataset i have 4 columns (See below), i would like to produce analysis based on those 4 Columns.

 

Emp ID  (Column A)

Manager ID  (Column B)

Department Name (Column C)

 

For a given Hierarchy determined by "Column A & "Column B count the DISTNICTCOUNT for the Department name for all childs based on the parent 

this is example from the measure i wrote

MC_DepartmentName =
CALCULATE (
    DISTINCTCOUNT('All_employees'[Department Name]),
    TREATAS ( { 'All_employees'[Emp ID] }, 'All_employees'[Manager ID] ),
    ALL ( 'All_employees' )
)+0
BUT it reurn only the manager level not all the childs
any help
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Mohamedali ,

Please update the formula of measure [MC_DepartmentName] as below and check if it can get your expected result...

MC_DepartmentName = DISTINCTCOUNT('All_employees'[Department Name])

yingyinr_0-1665641890550.png

 

If the above one can't help you get the desired result, please provide some sample data in your table 'All_employees' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Mohamedali ,

Please update the formula of measure [MC_DepartmentName] as below and check if it can get your expected result...

MC_DepartmentName = DISTINCTCOUNT('All_employees'[Department Name])

yingyinr_0-1665641890550.png

 

If the above one can't help you get the desired result, please provide some sample data in your table 'All_employees' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors