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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
hugo_barbara
Helper I
Helper I

RLS Dynamic with Multiple Users

Hey guys!

I tried to make a dynamic RLS per access level, but I was unable to make the first level able to access all the information.

The context would be that level 1 users can access all information, level 2 will only access data from their region and level 3 will only be able to access the region and its respective sector.

When creating the dax code I made this example below:

VAR LevelAcess = LOOKUPVALUE(dUser[Role], dUser[User], USERPRINCIPALNAME())
VAR RegionUser = LOOKUPVALUE(dUser[Region], dUser[User], USERPRINCIPALNAME())
VAR SectorUser = LOOKUPVALUE(dUser[Sector], dUser[User], USERPRINCIPALNAME())
RETURN

IF (
    LevelAcess = 1,
    TRUE(),
    IF(
        LevelAcess = 2,
        [Region] = RegionUser,
        IF (
            LevelAcess = 3,
            [Region] = RegionUser && [Sector] = SectorUser,  
            FALSE()
        )
    )
)

Here are the bases and their respective relationship:
hugo_barbara_0-1734529354386.pnghugo_barbara_1-1734529367700.pnghugo_barbara_2-1734529390036.png

 



1 ACCEPTED SOLUTION
mark_endicott
Super User
Super User

@hugo_barbara - There are a few things here.

 

1) Check on which table your rule is applied - The way your DAX is written it should be applied to the 'fVendas' table. 

2) If this is were your DAX rule is being used, then you should not use relationships, because the LOOKUP will find the relevant data from dUser and apply it to fVendas through a virtual relationship. 

3) In particular the bi-directional nature of one of your relationships will be causing the RLS to fail. 

4) The inactive relationship can remain, but it may cause you errors or failing RLS when the particular measure that 'activates' it is used. 

 

If this helps, please accept it as the solution to help others with the same challenge. 

View solution in original post

2 REPLIES 2
hugo_barbara
Helper I
Helper I

@mark_endicott 

Thank you very much!! When following the steps provided, I was able to see the error.

Thank you very much!

mark_endicott
Super User
Super User

@hugo_barbara - There are a few things here.

 

1) Check on which table your rule is applied - The way your DAX is written it should be applied to the 'fVendas' table. 

2) If this is were your DAX rule is being used, then you should not use relationships, because the LOOKUP will find the relevant data from dUser and apply it to fVendas through a virtual relationship. 

3) In particular the bi-directional nature of one of your relationships will be causing the RLS to fail. 

4) The inactive relationship can remain, but it may cause you errors or failing RLS when the particular measure that 'activates' it is used. 

 

If this helps, please accept it as the solution to help others with the same challenge. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.