Forum Discussion

_Martin123's avatar
_Martin123
Frequent Visitor
3 years ago
Solved

Row Level Security based on USERPRINCIPALNAME() and Company hierarchy

Hi Community, I need your help πŸŽ‰ The scope of this task is to grant users row level access based on their USERPRINCIPALNAME(), and the company hierarchy they belong to. There are approximately ...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi _Martin123 

    I delete the relationship among the three tables, then create dax in RLS

    You can refer to it.

     

    VAR _userentity =
        CALCULATE ( MAX ( RLSUser[Entity] ), RLSUser[User mail] = USERPRINCIPALNAME () )
    VAR _entityID =
        CALCULATE ( MAX ( RLSEntity[Entity ID] ), RLSEntity[Entity] = _userentity )
    VAR _filter =
        SUMMARIZE (
            FILTER ( RLSEntity, CONTAINSSTRING ( [Path], _entityID ) ),
            [Entity]
        )
    RETURN
        [Entity] IN _filter
    

     

    Output

     

    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.