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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
LP280388
Resolver II
Resolver II

Find Manager in the filtered list and put 1 against his ID

Hi team,

 

have data in the below format. 

 

employeeNameManager 
101COE 
102Deputy CEO101
103Sr Manager1102
104Sr Manager2102
105Dev 3103
106Dev 4103
107Dev 5103
108Dev 6106
109Dev 7104
110Dev 8104

 

When the RLS is applied for Sr. Manager1 below is the output seen to see himself and his direct reportees.  

I have the below dax to put 1 against the employee when they are present in the Manager columns.  

corpismgr? = IF(CALCULATE(COUNT('table'[employee]),'table'[employee] in VALUES('table'[Manager]))>=1,1,0)

Currently, its putting in 1 for employee 106 as well since he is a manager for 108. 

employeeNameManager output expected
103Sr Manager11021
105Dev 31030
106Dev 41031
107Dev 51030

I would need the output as below. the dax should be looking for a manager within the filtered list.  can anyone help me how to modify the dax above to restrict to filtered list only?

Below is the output expected when Sr. Manager1 logs in.

employeeNameManager output expected
103Sr Manager11021
105Dev 31030
106Dev 41030
107Dev 51030




2 ACCEPTED SOLUTIONS
danextian
Super User
Super User

hi @LP280388 

This might be what you're looking for

Employee is Manager = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    'Table'[employee] IN ALL ( 'Table'[Manager] )
)

danextian_0-1737626005745.png

Note: You cannot make the other employee appear 0 as Sr Manager1 is the only row that is visible based on the current filter.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

Anonymous
Not applicable

Hi,

Thanks for the solution danextian  and bhanu_gautam  offered, and i want to offer some more infotmation for user to refer to.

hello @LP280388 , you can refer to the following solution.

Create a new table.

Employee = SUMMARIZE('Table',[employee],[Name])

vxinruzhumsft_0-1737688198909.png

Then create a measure

MEASURE =
VAR a =
    CALCULATETABLE (
        VALUES ( 'Table'[employee] ),
        FILTER ( 'Table', [Manager] IN VALUES ( 'Employee'[employee] ) )
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table'[employee] ) IN VALUES ( 'Employee'[employee] ),
        1,
        IF ( COUNTROWS ( a ) > 0, 0 )
    )

Then create a slicer and put the name field of the employee table to the slicer. and create a table visual, put the measure and the field of the data table to it.

vxinruzhumsft_1-1737688260870.png

 

vxinruzhumsft_2-1737688274275.png

 

Output

vxinruzhumsft_3-1737688302903.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi,

Thanks for the solution danextian  and bhanu_gautam  offered, and i want to offer some more infotmation for user to refer to.

hello @LP280388 , you can refer to the following solution.

Create a new table.

Employee = SUMMARIZE('Table',[employee],[Name])

vxinruzhumsft_0-1737688198909.png

Then create a measure

MEASURE =
VAR a =
    CALCULATETABLE (
        VALUES ( 'Table'[employee] ),
        FILTER ( 'Table', [Manager] IN VALUES ( 'Employee'[employee] ) )
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table'[employee] ) IN VALUES ( 'Employee'[employee] ),
        1,
        IF ( COUNTROWS ( a ) > 0, 0 )
    )

Then create a slicer and put the name field of the employee table to the slicer. and create a table visual, put the measure and the field of the data table to it.

vxinruzhumsft_1-1737688260870.png

 

vxinruzhumsft_2-1737688274275.png

 

Output

vxinruzhumsft_3-1737688302903.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

danextian
Super User
Super User

hi @LP280388 

This might be what you're looking for

Employee is Manager = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    'Table'[employee] IN ALL ( 'Table'[Manager] )
)

danextian_0-1737626005745.png

Note: You cannot make the other employee appear 0 as Sr Manager1 is the only row that is visible based on the current filter.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
bhanu_gautam
Super User
Super User

@LP280388 , Try using this 

 

corpismgr? = IF(
CALCULATE(
COUNT('table'[employee]),
FILTER(
ALL('table'),
'table'[employee] = EARLIER('table'[Manager])
)
) >= 1,
1,
0
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






@bhanu_gautam , This is giving 1 for all the records filtered like below 

employeeNameManager output expected
103Sr Manager11021
105Dev 31031
106Dev 41031
107Dev 51031


It should give 1 against 103 employee ID only

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.