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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Pbi07
Helper V
Helper V

Using RLS with Dynamic filter

I needed some help with the RLS in my model. 

 

Trying to set up RLS on my dimensions so that it gets filtered in to the transaction as well. But, i was 

 

I have 2 dimension table with Products and region info. I have the user information with the region name tied to it. 

Pbi07_0-1635303118235.png

Luis has responsibility of specific products and i need to show only the sales that Luis is tied from transactions 

Pbi07_1-1635303233439.png

 

Pbi07_2-1635303279281.png

 

How to set the RLS on the dimesniosn so that it is driven dynamically based on the user info. Luis is in EU region and i don't want to hardcode this in the RLS. How to model this dynamically? 

 

Pbix is https://drive.google.com/file/d/1yxPLYii4V_uIvKkTxk30wbvbl_hSNzqO/view?usp=sharing

 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Pbi07 ,

I updated your sample pbix file, please check whether that is what you want.

1. Create relationship between table Users and Products

yingyinr_0-1635497824244.png

2. Create a role for the table Users with the formula as below

[PrincipalName] =USERPRINCIPALNAME()

yingyinr_2-1635497932709.png

3. Test role

yingyinr_1-1635497882716.png

In addition, you can refer the content in the following links to get it.

Dynamic RLS setup in Power BI

Dynamic Row Level Security with Power BI Made Simple

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @Pbi07 ,

I updated your sample pbix file, please check whether that is what you want.

1. Create relationship between table Users and Products

yingyinr_0-1635497824244.png

2. Create a role for the table Users with the formula as below

[PrincipalName] =USERPRINCIPALNAME()

yingyinr_2-1635497932709.png

3. Test role

yingyinr_1-1635497882716.png

In addition, you can refer the content in the following links to get it.

Dynamic RLS setup in Power BI

Dynamic Row Level Security with Power BI Made Simple

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Pbi07 , Based on what I got

 

The first and the third table should join on the region.

And in you should create a role to filter the first table 

table1[email] = userprincipalname()

 

How to use Row Level Security (RLS): https://youtu.be/NfdIA0uS6Nk

 

 

Thanks @amitchandak 

 

If i join the user and the region that is going to be a many to many relation. 

Sorry if i didn't explain this properly. My intention is to drive this in such a way that if the user is assigned the Region in the AD ( which is the first table - User ) that should drive the region filter in the dimension also. 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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