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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Need help with this DAX

Hello Everyone,

I need to find the no of employees under a manager?

Table: "emp_tbl"

 
No of Emps=
            COUNTROWS (FILTER(ALL ('emp_tbl', 
                                                       'emp_tbl'[Emp]= 'emp_tbl'[Emp]
                                                        &&  'emp_tbl'[Emp Type]= "New Joiners" )))
 

Do I need a self join or group by in DAX?

 
tanisha10_0-1597285449855.png

 

Thanks In Advance
 
 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

According to my understanding, you want to count the number of Emp under each manager when their type is New Joiners, right?

You could use the following formula:

No of Emps =
COUNTROWS (
    FILTER (
        ALL ( emp_tbl ),
        emp_tbl[Manager] = MAX ( emp_tbl[Manager] )
            && emp_tbl[Emp type] = "New Joiners"
    )
)

My visualization looks like this:

8.13.6.png

Is the result what you want? If not, please upload some data samples and expected output.

Please do mask sensitive data before uploading.

 

Best Regards,

Eyelyn Qin

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

HI @Anonymous ,

Did I answer your question ? Please mark my reply as solution. Thank you very much~

If not, please upload some insensitive data samples and expected output.

 

Best Regards,

Eyelyn Qin

Anonymous
Not applicable

Hi @Anonymous ,

According to my understanding, you want to count the number of Emp under each manager when their type is New Joiners, right?

You could use the following formula:

No of Emps =
COUNTROWS (
    FILTER (
        ALL ( emp_tbl ),
        emp_tbl[Manager] = MAX ( emp_tbl[Manager] )
            && emp_tbl[Emp type] = "New Joiners"
    )
)

My visualization looks like this:

8.13.6.png

Is the result what you want? If not, please upload some data samples and expected output.

Please do mask sensitive data before uploading.

 

Best Regards,

Eyelyn Qin

 

Greg_Deckler
Community Champion
Community Champion

@Anonymous - What is your expected output from your sample data? This may be a transitive closure situation, I remember doing something similar to this in the past and I believe it was a spin on transitive closure. The specific problem was related to calculating commissions for a sales person hierarchy.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Transitive-Closure/m-p/783828#M388

 

Basically you have to walk the hierarchy unless you are just going for direct reports. The PATH functions may be of use.

https://docs.microsoft.com/en-us/dax/path-function-dax



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...
amitchandak
Super User
Super User

@Anonymous , you need to create an employee table and join it both with Emp and manager. Keep emp join active and manager join inactive and when to want to know employee under manager the activate the join using userelation

 

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors