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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

undefined

I have this hierarchical table of employees that I have created a report to the line managers. But I want to restrict the level of granularity a manager should see. For example, my data has 8 levels of hierarchy and I want the managers to be able to see data for not more than 2 levels below them in the hierarchy. That is, no matter what level the manager is he should be able to see the data of his own report, the report of the first person , say "A" below him and the report of the next person, say "B" who is below "A". He should not see any report lower than that level. Please, I need your help. I have already created a filter to filter that each manager can see everyone below them usint their USERPRINCIPALNAME().

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous  ,

 

Create an unrelated Employee_ID table as slicer.

Table 2 = DISTINCT('Table'[Employee_ID])

Use the path function to find the entire path from one member in original table and create Path length column.

Path = PATH('Table'[Employee_ID],'Table'[Manager's Employee_ID])
Path Length = PATHLENGTH('Table'[Path])

 

Create a measure to determine whether it is the longest path and apply it in visual level filter.

Measure = IF(SEARCH(SELECTEDVALUE('Table 2'[Employee_ID]),MAX('Table'[Path]),1,0)>0&&MAX('Table'[Path Length])=CALCULATE(MAX('Table'[Path Length]),ALL('Table')),1,0)
 

Refer to the:

Sample .pbix

 

Best Regards,
Liang
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
V-lianl-msft
Community Support
Community Support

Hi @Anonymous  ,

 

Create an unrelated Employee_ID table as slicer.

Table 2 = DISTINCT('Table'[Employee_ID])

Use the path function to find the entire path from one member in original table and create Path length column.

Path = PATH('Table'[Employee_ID],'Table'[Manager's Employee_ID])
Path Length = PATHLENGTH('Table'[Path])

 

Create a measure to determine whether it is the longest path and apply it in visual level filter.

Measure = IF(SEARCH(SELECTEDVALUE('Table 2'[Employee_ID]),MAX('Table'[Path]),1,0)>0&&MAX('Table'[Path Length])=CALCULATE(MAX('Table'[Path Length]),ALL('Table')),1,0)
 

Refer to the:

Sample .pbix

 

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

Greg_Deckler
Community Champion
Community Champion

@Anonymous See if this helps: https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Hierarchical-Row-Level-Security/m-p/889567#M406



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 , See if these documents around RLS for organizational hierarchy can help

https://radacad.com/dynamic-row-level-security-with-organizational-hierarchy-power-bi
https://www.blue-granite.com/blog/using-dynamic-row-level-security-with-organizational-hierarchies

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
Anonymous
Not applicable

nks Amit, this is exactly what guided me and all is working well apart from the fact that I'm not able to limit the view of the managers to view only two steps downwards below them. This means that the CEO will be seeing information for 7 stages below him which is not what I want. How do I limit this in the DAX below for example?

 

PATHCONTAINS(CurrentEmployees[Current_IDpath],

MAXX(FILTER(CurrentEmployees,

[Manager_Email_Address] = USERPRINCIPALNAME()),
CurrentEmployees[Staff_Number))

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.