cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
elimey68
Helper III
Helper III

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
elimey68
Helper III
Helper III

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
Super User IV
Super User IV

@elimey68 - 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.


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




elimey68
Helper III
Helper III

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

amitchandak
Super User IV
Super User IV

@elimey68 , have created hierarchy like this

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

 

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.