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
muralidharan_79
Frequent Visitor

Addressing Heirarchy

I need to implement RLS to the following dataset. I have a table where it has UnitID, ParentUnitID, Level and its respective UserID. Organization in here is set up in a way starting from Level 1 which is in the top of the hierarchy followed by 2, 3, 4 and 5. All these can be linked through ParentUnitID. For example X unit from Level 3 will have both UnitID and ParentUnitID, where ParentUnitID of this X Unit is linked to the level 2 unit and unitID of this X unit is linked to the Level 4 units.

 

Now for example, if a user has access to L3 and L5 unit (which we can consider as direct) he should also able to see the respective Level 4 units as well.

 

So the expected table / output is to have a one single table which should have both direct and indirect units, so that RLS can be applied on this table and filter the model. Kindly shed some ideas on this. Thanks in advance!

 

Sample of Units Table

muralidharan_79_0-1723628443002.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @muralidharan_79 ,

As I understand it, if you want to rely on parentUnitID for hierarchical structure hierarchies, you can use the PATH function in DAX.

 

Path=PATH('Table'[UnitID],'Table'[ParentUnitID])

 

vxingshenmsft_1-1723699757498.png

Use these two MEASURES to determine the ID to determine their hierarchy.

 

UserL3Acess=LOOKUPVALUE('Table (2)'[AccessibleUnitID],'Table (2)'[UserID],"UserA",'Table (2)'[AccessibleLevel],"L3")
UserL5Access=LOOKUPVALUE('Table (2)'[AccessibleUnitID],'Table (2)'[UserID],"UserA",'Table (2)'[AccessibleLevel],"L5")

 

 

HasAccessToL 113=IF(
    PATHCONTAINS('Table'[Path],[UserL5Access])||PATHCONTAINS('Table'[Path],[UserL3Acess]),
    1,
    0
)

 

By calculating the columns we can see that if level 3 and level 5 can be seen, then level 4 can also be seen.

vxingshenmsft_2-1723700000751.png

Finally, perform the Rls setup and verify that it was successful.

vxingshenmsft_3-1723700188193.png
vxingshenmsft_4-1723700211704.png

 

If you still have other questions, you can check the PBIX file I uploaded, maybe it can help you with your question, about the use of PATH function, there is a case to talk about very detailed and easy to understand, I paste it below for you, I hope it can answer your questions.

Solved: How to Create Organization Chart in Power BI Deskt... - Microsoft Fabric Community

 

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

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

1 REPLY 1
Anonymous
Not applicable

Hi @muralidharan_79 ,

As I understand it, if you want to rely on parentUnitID for hierarchical structure hierarchies, you can use the PATH function in DAX.

 

Path=PATH('Table'[UnitID],'Table'[ParentUnitID])

 

vxingshenmsft_1-1723699757498.png

Use these two MEASURES to determine the ID to determine their hierarchy.

 

UserL3Acess=LOOKUPVALUE('Table (2)'[AccessibleUnitID],'Table (2)'[UserID],"UserA",'Table (2)'[AccessibleLevel],"L3")
UserL5Access=LOOKUPVALUE('Table (2)'[AccessibleUnitID],'Table (2)'[UserID],"UserA",'Table (2)'[AccessibleLevel],"L5")

 

 

HasAccessToL 113=IF(
    PATHCONTAINS('Table'[Path],[UserL5Access])||PATHCONTAINS('Table'[Path],[UserL3Acess]),
    1,
    0
)

 

By calculating the columns we can see that if level 3 and level 5 can be seen, then level 4 can also be seen.

vxingshenmsft_2-1723700000751.png

Finally, perform the Rls setup and verify that it was successful.

vxingshenmsft_3-1723700188193.png
vxingshenmsft_4-1723700211704.png

 

If you still have other questions, you can check the PBIX file I uploaded, maybe it can help you with your question, about the use of PATH function, there is a case to talk about very detailed and easy to understand, I paste it below for you, I hope it can answer your questions.

Solved: How to Create Organization Chart in Power BI Deskt... - Microsoft Fabric Community

 

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

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

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.