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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
POSPOS
Post Partisan
Post Partisan

How to restrict data based on hierarchy

Hi All,

I have a requirement to implement row level security based on the below data.

 

POSPOS_0-1740585607081.png

Level 1 , Level 2 and Level 3 are the hierarchies.

POSPOS_1-1740585642230.png

Requirement: My requirement is to implement row level security in such a way that, if  Level 1 logs in, he should see all data. If anyone from Level 2 logs in, he should see their specific Level 3 data.

 

Eg:

If Level 1=SM1 logs in, then he should see all data i.e., M1,M2,M3, E1,E2.....E8.

If Levrel2 =M1 logs in , he should only see E1,E2,E3.

 

Can someone please advise on how to implement this using the sample data provided. Pbix file is attached here.

Thank you.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

 

vlinhuizhmsft_0-1740637727360.png

Result:

vlinhuizhmsft_1-1740637772693.png

 

 

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.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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

 

vlinhuizhmsft_0-1740637727360.png

Result:

vlinhuizhmsft_1-1740637772693.png

 

 

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.

@Anonymous  - Thank you for your detailed response. The solution worked. 🙂

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.