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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
gsk135
Regular Visitor

Override RLS

I have a table which has a region field. I created a table as access with username, region, useradmin. 

 

I want to filter region on main table based on the username and region from access table. Useradmin's should able to see all the regions and should not filter anything. 

 

I tried below roles but it did not work. 

 

[username] = USERPRINCIPALNAME()

if ( [username] = USERPRINCIPALNAME(), true(), [useradmin]=USERPRINCIPALNAME())

1 ACCEPTED SOLUTION
SamWiseOwl
Super User
Super User

Hi @gsk135 

Assign something like as the filter on your security table

SWITCH(
    TRUE()
    ,USERNAME() IN VALUES(Security[User]) //if the username is in the security table
    ,Security[User] = USERNAME() //filter to that user
    ,USERNAME() = "Admin" //if the user is admin return true i.e all data
    ,TRUE()

)

SamWiseOwl_3-1734037555120.pngSamWiseOwl_4-1734037577688.pngSamWiseOwl_5-1734037596165.pngSamWiseOwl_6-1734037612652.png

To test click Modelling | View As then under Other user enter the name to test. Also tick the security role you created here mine is untitled


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

1 REPLY 1
SamWiseOwl
Super User
Super User

Hi @gsk135 

Assign something like as the filter on your security table

SWITCH(
    TRUE()
    ,USERNAME() IN VALUES(Security[User]) //if the username is in the security table
    ,Security[User] = USERNAME() //filter to that user
    ,USERNAME() = "Admin" //if the user is admin return true i.e all data
    ,TRUE()

)

SamWiseOwl_3-1734037555120.pngSamWiseOwl_4-1734037577688.pngSamWiseOwl_5-1734037596165.pngSamWiseOwl_6-1734037612652.png

To test click Modelling | View As then under Other user enter the name to test. Also tick the security role you created here mine is untitled


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 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.