cancel
Showing results for
Did you mean:
Helper III

## Count in hierarchy

I have a hierarchy in my Employee table as follow:

It means that each teamLeader has many team members.

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

1 ACCEPTED SOLUTION
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
3 REPLIES 3
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!

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

@elimey68 , have created hierarchy like this

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!

Announcements

#### Welcome to the User Group Public Preview

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

#### 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.

#### Experience what’s next for Power BI

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

Top Solution Authors
Top Kudoed Authors