Forum Discussion

POSPOS's avatar
POSPOS
Post Partisan
1 year ago
Solved

How to restrict data based on hierarchy

Hi All, I have a requirement to implement row level security based on the below data.   Level 1 , Level 2 and Level 3 are the hierarchies. Requirement: My requirement is to implement ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi POSPOS , 

     

    Please use the following formula:

     

    VAR _user =
        USERPRINCIPALNAME ()
    VAR _is_l1 =
        _user IN VALUES ( 'Table'[Level 1] )
    VAR _is_l2 =
        _user IN VALUES ( 'Table'[Level 2] )
    VAR _is_l3 =
        _user IN VALUES ( 'Table'[Level 3] )
    RETURN
        IF (
            _is_l3,
            'Table'[Level 3] = _user,
            IF ( _is_l2, 'Table'[Level 2] = _user, IF ( _is_l1, 'Table'[Level 1] = _user ) )
        )

     

    Result:

     

     

    Best Regards,
    Zhu

     

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