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

Count number of Direct Reports

Hi,

I have three columns in my table - EmpID, Supervisor and Level. I need to find out count of number of direct reports for a particular EmpID using the Supervisor column but only for the Leader, Manager and Director levels. The count of number of direct reports should be populated in a new column (CountofDirectReports). I highlighted CountofDirectReports column in yellow where the count needs to go. I working to figure it out using DAX but could not figure it out. Can someone please help?

 

Here is the sample data as an example:

 

SampleDataforPowerBICommunity.png

 

Thanks for your help!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Anonymous 

You can use a measure like so to add a calculated column to your table:

DirectReports = 
VAR CurrentEmp = 'Table'[EmpID]
RETURN
CALCULATE(
    COUNTROWS('Table'),
    ALL('Table'),
    'Table'[Supervisor] = CurrentEmp
)

DirectReports.jpg

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

Hello @Anonymous 

You can use a measure like so to add a calculated column to your table:

DirectReports = 
VAR CurrentEmp = 'Table'[EmpID]
RETURN
CALCULATE(
    COUNTROWS('Table'),
    ALL('Table'),
    'Table'[Supervisor] = CurrentEmp
)

DirectReports.jpg

Anonymous
Not applicable

This worked. Thank you for your help!

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.