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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.