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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Optimusprime_25
Resolver I
Resolver I

Dynamic RLS based on many to many relationships. between two tables

Hello All,

 

We have two tables in the report.

One is report table which contains data, multiple columns along with country and unit as columns.

We have another table where we have user access details in this table.

 

We have to join many to many relationships between these two tables on country as well as unit, why because we want country and unit to be restricted based on access provided in the second table.

Optimusprime_25_0-1673941423933.png

Below is the many -to- many relationships between country and unit columns between two tables.

Optimusprime_25_1-1673942124381.png

 

Can anyone please provide me the solution, how to create dynamic RLS whereas one specif user should be able to see only the data for which he/she has access.

 

Thank you.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Optimusprime_25 , Create a combine column

 

Key = [Country] & "-" & [unit]

 

for the direct query, you use combinevalues

 

then you can create RLS using the user 

 

[user_id] = userprincipalname()

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

HiraNegi
Resolver II
Resolver II

Hi @Optimusprime_25 ,

You may follow below steps with sample scenario.

 

1. Main Data with custom column to concat Country and Unit:

HiraNegi_0-1673944424450.png

 

2. User Data with custom column to combine Country and Unit.

HiraNegi_1-1673944477837.png

 

3. Create join between tables on ID field.

HiraNegi_2-1673944522551.png

 

4. Create new role with filter on UserID = userprincipalname()

This will dynamically filter the dataset for the user login mail id.

HiraNegi_3-1673944662454.png

 

5. Verify if the roles are working as expected.

HiraNegi_4-1673944823611.pngHiraNegi_5-1673944843248.png

 

Hope this helps.

 

Regards,

Hira Negi

 

Please don't forget to upvote and Accept as answer if the reply is helpful

 

View solution in original post

5 REPLIES 5
HiraNegi
Resolver II
Resolver II

Hi @Optimusprime_25 ,

You may follow below steps with sample scenario.

 

1. Main Data with custom column to concat Country and Unit:

HiraNegi_0-1673944424450.png

 

2. User Data with custom column to combine Country and Unit.

HiraNegi_1-1673944477837.png

 

3. Create join between tables on ID field.

HiraNegi_2-1673944522551.png

 

4. Create new role with filter on UserID = userprincipalname()

This will dynamically filter the dataset for the user login mail id.

HiraNegi_3-1673944662454.png

 

5. Verify if the roles are working as expected.

HiraNegi_4-1673944823611.pngHiraNegi_5-1673944843248.png

 

Hope this helps.

 

Regards,

Hira Negi

 

Please don't forget to upvote and Accept as answer if the reply is helpful

 

Hi HiraNegi,

 

Hope you are doing well!

I am also facing the same issue but in Power BI report server. And Many to Many relationship is not available in Power BI report server, could you please help me on priority with some solution.

 

Regars

Sartaj

Thanks @HiraNegi , I have implemented your solution and it's working.

amitchandak
Super User
Super User

@Optimusprime_25 , Create a combine column

 

Key = [Country] & "-" & [unit]

 

for the direct query, you use combinevalues

 

then you can create RLS using the user 

 

[user_id] = userprincipalname()

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks @amitchandak ,  I have implemented your solution and it's working.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors