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! Learn more

Reply
imranamikhan
Helper V
Helper V

Dynamic Row Level Security - Duplicates

Hi everyone,

 

I have a generic Data Table with a list of customer IDs and company codes.

 

I have a Mapping Table of distinct company codes and associated users.

 

Using the unique company code in the Mapping Table, I have created a one-to-many-relationship with the Data Table.

 

I then created a calculated column to bring the associated User using a RELATED function.

Example.PNG

 

relationship.PNG

 

I have then set up role level security so that users can see only company codes associated to them in all PowerBI reports. This is working as expected.


RLS Screenshot.PNG

However, there will be scenarios where one company code will be associated to multiple users. If I create duplicate company codes in the Mapping Table per number of associated users, this will break the relationship between the Mapping Table and the Data Table.

Example Duplicates.PNG

 

Could anyone advise a better approach? I have tried following the suggestion below by creating a table which only contains unique company codes to act as a bridge between the Mapping Table and Data Table, but this has not worked for me.

https://nineboards.com/dynamic-row-level-security-in-power-bi/

 

best regards,

Ami

1 ACCEPTED SOLUTION
imranamikhan
Helper V
Helper V

Thanks for the support all.

 

@MFelix  - I was testing RLS on the portal. However I followed the instructions in this blog and I have managed to achieve what I needed.

https://www.tallan.com/blog/2018/04/10/row-level-security-in-power-bi-part-1-roles-and-users/

 

solution.PNG

View solution in original post

3 REPLIES 3
imranamikhan
Helper V
Helper V

Thanks for the support all.

 

@MFelix  - I was testing RLS on the portal. However I followed the instructions in this blog and I have managed to achieve what I needed.

https://www.tallan.com/blog/2018/04/10/row-level-security-in-power-bi-part-1-roles-and-users/

 

solution.PNG

aj1973
Community Champion
Community Champion

Hi @imranamikhan 

 

Change this relationship to Both

aj1973_0-1609853875126.png

 

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

MFelix
Super User
Super User

Hi @imranamikhan ,

 

Believe that the approach used in the link you provided is the correct one, however be aware that you need to have the filter for both sides  on the relationship between the company and the user/company table.

 

Where have you tried the RLS on the portal or to simulate it in the desktop version?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors