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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
redwings00
Helper I
Helper I

Direct - Indirect Report Help

Hello,

I am looking for some assistance with showing Direct and Indirect reports.

 

This previous thread below provided a great start for myself but I am now trying to expand on this.

https://community.powerbi.com/t5/Desktop/how-to-get-direct-and-indirect-employees-count/m-p/329780 

 

What I am now looking to do:

1. Show the count of Direct Reports and Indirect Reports instead of the list of employee ID's

2. Show the employee names instead of the employee ID's

 

I've attached a sample pbix file: https://www.dropbox.com/s/ohs5icepwebdhs0/Direct-Indirect.pbix?dl=0 

 

Any assistance would be appreciated.

 

Thank you,

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@redwings00 Easiest thing would be:

Measure = IF(ISBLANK([Measure - Direct Reports]),BLANK(),LEN([Measure - Direct Reports]) - LEN(SUBSTITUTE([Measure - Direct Reports],",","")) + 1)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
Greg_Deckler
Community Champion
Community Champion

@redwings00 Easiest thing would be:

Measure = IF(ISBLANK([Measure - Direct Reports]),BLANK(),LEN([Measure - Direct Reports]) - LEN(SUBSTITUTE([Measure - Direct Reports],",","")) + 1)


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  - Thank you so much. This works great to get the total counts. Would you know if it would be possible to show the names instead of the ID's?

@redwings00 Like:

Measure - Direct Reports 1 = 
VAR __empid = MAX('Sheet1'[EMP ID])
VAR direct = FILTER(ALL('Sheet1'),[MANAGER ID] = __empid)
RETURN
    IF ( ISEMPTY ( direct ) = FALSE (), CONCATENATEX ( direct, [EMPLOYEE NAME], ", " ) )

I tell people not to use VALUES and CALCULATE but does anyone listen? 🙂



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  Thank you again Greg. Would you be able to help with the measure for the indirect names if possible?

I was not aware of the information regarding not to use VALUES and CALCULATE, but will definitely need to read it as I get more comfortable in power BI

@redwings00 Well, that's just my opinion on VALUES and CALCULATE. Indirect is a very simple change:

Measure - Indirect Reports 1 = 
    VAR __empid = MAX('Sheet1'[EMP ID])
    VAR direct = SELECTCOLUMNS(FILTER(ALL('Sheet1'),[MANAGER ID] = __empid),"__EMP_ID",[EMP ID])
    VAR indirect = FILTER(ALL('Sheet1'),[MANAGER ID] IN direct)
RETURN
    IF ( ISEMPTY ( indirect ) = FALSE (), CONCATENATEX ( indirect, [EMPLOYEE NAME], ", " ) )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

I'm now wanting to add further layers to get the child relationship of the indirects and so on, I have tried this, but I'm receiving an error: Function CONTAINSROW must hav a value for each column in the table expression.

 

If I could get all the Indirect and child names into one measure that would be more efficient. I think I have up to 8 child layers

 

Measure - CHILD Reports 1 = 
    VAR __empid = MAX('Sheet1'[EMP ID])
    VAR direct = SELECTCOLUMNS(FILTER(ALL('Sheet1'),[MANAGER ID] = __empid),"__EMP_ID",[EMP ID])
    VAR indirect = FILTER(ALL('Sheet1'),[MANAGER ID] IN direct)
    VAR child = FILTER(ALL('Sheet1'),[Manager ID] IN indirect
RETURN
    IF ( ISEMPTY ( child ) = FALSE (), CONCATENATEX ( child, [EMPLOYEE NAME], ", " ) )

 

@redwings00 You should explore the PATH functions.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.