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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Manager Count/Filter Code

Hi Folks,

 

I have the following dataset as an example: 

 

EE IDNameEE TypeManager IDManager Name
11111Bell, TacoContractor22241Frog, Kermit
11112Jones, JessicaEmployee22241Frog, Kermit
22241Frog, KermitEmployee65584Blue, Gonzo
333544Piggy, MissEmployee65656Animal, Wild
65584Blue, GonzoEmployee22241Frog, Kermit
65656Animal, WildContractor11114Piano, Rowlf

 

We have a number of managers in our company as notated in the last column. Those managers are also employees as you can see in column 2 (I didn't build them all out). We also have two types of employees: employee and contractor. However, we do not consider a manager a "people manager" unless they are managing at least one employee.

 

What I want to do is get a DISTINCT COUNT of how many managers are managing EMPLOYEE's. So in this example, the count would be 3 because we have Kermit Frog, Gonzo Blue, and Wild Animal. Rowlf should not show up as part of the count because he's only managing a contractor. 

 

I know when I do a DISTINCTCOUNT DAX to get the number of managers by ID it gives me 4, which is great, but I want it to only give me 3 because Rowlf only has a contractor. 

 

I tried using DISTINCTCOUNT and FILTER but I can't seem to get it right. Any help would be great please. 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous,

 

I created a measure

 

Count of Manager = CALCULATE(DISTINCTCOUNT(Employee[Manager ID]), FILTER(Employee, Employee[EE Type] = "Employee"))

 

I got count 3. Could you please try this and see if it works for you?

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous,

 

I created a measure

 

Count of Manager = CALCULATE(DISTINCTCOUNT(Employee[Manager ID]), FILTER(Employee, Employee[EE Type] = "Employee"))

 

I got count 3. Could you please try this and see if it works for you?

Anonymous
Not applicable

That is exactly what I needed. I was doing '&&' instead of "," between DISTINCTCOUNT and FILTER. Glad to know I wasn't far off. Thank you!

Anonymous
Not applicable

That is exactly what I needed. I was doing '&&' instead of "," between DISTINCTCOUNT and FILTER. Glad to know I wasn't far off. Thank you!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.