cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Count Number of Team Members Per Manager

Hi Everyone,

I'm trying to create a measure that will count the number of team members under each manager. I already have a many to one relationship between the employees data and the manager names' table.

 

Please help! It seems simple but I can't figure out what's wrong with my model.

 

This is the measure I have:

 

NumofTeamMembers= CALCULATE(COUNTA('Employee'[Name]),'Employee' [ManagerName]='Managers'[ManagerName])

 

The error message is the following: The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression.

 

Screenshot 2020-12-18 160549.jpg

 

Any help is really appreciated, thank you!!

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

@Anonymous  Try just a simple measure: 

 

NumofTeamMembers= COUNTA('Employee'[Name])

 

Then put this in a visual in Values with Manager table, Manager column in the columns/rows/axis field (depending on what visual you select).

 

Also, please set the cross filter direction of your relationship to single if you don't need it to both. https://excelwithallison.blogspot.com/2020/08/its-complicated-relationships-in-power_92.html

 


Please @mention me in your reply if you want a response.

Check out my Olympics report with live stats - KUDOS much appreciated

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

5 REPLIES 5
AllisonKennedy
Super User
Super User

@Anonymous  You're welcome. 🙂 


Please @mention me in your reply if you want a response.

Check out my Olympics report with live stats - KUDOS much appreciated

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Anonymous
Not applicable

Thank you, the function works!!

AllisonKennedy
Super User
Super User

@Anonymous  Try just a simple measure: 

 

NumofTeamMembers= COUNTA('Employee'[Name])

 

Then put this in a visual in Values with Manager table, Manager column in the columns/rows/axis field (depending on what visual you select).

 

Also, please set the cross filter direction of your relationship to single if you don't need it to both. https://excelwithallison.blogspot.com/2020/08/its-complicated-relationships-in-power_92.html

 


Please @mention me in your reply if you want a response.

Check out my Olympics report with live stats - KUDOS much appreciated

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@Anonymous , I do not see need ot this join

 

NumofTeamMembers= CALCULATE(COUNTA('Employee'[Name]))

 

if needed it will work like

 

NumofTeamMembers= CALCULATE(COUNTA('Employee'[Name]),filter('Employee', 'Employee' [ManagerName]=max('Managers'[ManagerName])))

 

 

if you need Avg

averagex(Values('Managers'[ManagerName]) , CALCULATE(COUNTA('Employee'[Name])))

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!
!! Subscribe to my youtube Channel !!
Anonymous
Not applicable

Thank you, it works!!

Helpful resources

Announcements
Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

Power BI Dev Camp Session 22 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!