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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Count in hierarchy

I have a hierarchy in my Employee table as follow: 

elimey68_0-1599480361733.png

It means that each teamLeader has many team members. 

How can I dynamically count the number of memebers per team leader??

1 ACCEPTED SOLUTION
Anonymous
Not applicable

following the suggestions in this post :
https://community.powerbi.com/t5/Desktop/DAX-SQL-window-function-equivalent/td-p/146128

I made a calculated column like this : 

MemebrsCount =
COUNTAX (
FILTER ( Employee; EARLIER (Employee[TeamLeaderName]) = Employee[TeamLeaderName] );
Employee[FullName]
)
 
 
and it counts me the numbers of team members per team leader

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous - So are you saying this is solved? Or are you still looking for a measure to do this? The solution will depend upon your data if you can share sample data. Generally involves using the PATH set of functions, like PATHLENGTH, etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

following the suggestions in this post :
https://community.powerbi.com/t5/Desktop/DAX-SQL-window-function-equivalent/td-p/146128

I made a calculated column like this : 

MemebrsCount =
COUNTAX (
FILTER ( Employee; EARLIER (Employee[TeamLeaderName]) = Employee[TeamLeaderName] );
Employee[FullName]
)
 
 
and it counts me the numbers of team members per team leader
amitchandak
Super User
Super User

@Anonymous , have created hierarchy like this

https://radacad.com/parsing-organizational-hierarchy-or-chart-of-accounts-in-power-bi-with-parent-child-functions-in-dax

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors