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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
SebRosolen
New Member

Power BI Dynamic RLS Role

Hello everyone, 

 

I am trying to set up a dynamic RLS role so that users who belong to the role can only see the data based on the email address that they used to log in. I need to map the email addresses to a "tenant_id", which will be the main filter that is used to filter all other tables. 

 

My idea is to set up an additional table called "power_bi_users" with two columns, 'user_email' and 'tenant_id', then use dynamic RLS to specify that power_bi_users.user_email must equal username(). That row filter will then be passed through through to the tenant table via the tenant_id, which passes the tenant_id through to all other tables. 

 

My question is whether or not this is the best approach? Or is there a way to use another function instead of username() which calls a custom "tenant_id" field instead of returning an email address?

 

Thanks in advance!

Seb

1 REPLY 1
luisrh
Responsive Resident
Responsive Resident

We have been using CustomData() since the beginning of time in Analysis services,  and over a year ago,  MSFT added that capability for RLS in Power BI.   This is another way of doing it.   The DAX filtering is very flexible, though and you can pretty much target any fields.   The most important thing with RLS is to get your modeling correct so all dimension filters work correctly with measures,  etc.      See below for info on that feature -

The CustomData feature is now generally available in Power BI! | Microsoft Power BI Blog | Microsoft...

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.