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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.