Forum Discussion

muralidharan_79's avatar
muralidharan_79
Frequent Visitor
2 years ago
Solved

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 whic...
  • Anonymous's avatar
    Anonymous
    2 years ago

    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])

     

    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.

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

     

    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.