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
sms2000
Frequent Visitor

RLS based on user login

i have 2 excels 

1. domain, conatins the user, email, dept and company to which it belongs 

2. main excel , contains the data for each dept in the companies

 

i want to define RLS based on the first excel so that when the user logs in they see their respected data.

 

i have an active relationship between both the excels relating to company , and the dept is inactive.

i have defined user1 in manage roles and added filter email = username(), 

this works for the company as it is an active relationship but does not filter dept.

how can i write the RLS for Power BI to check the domain excel and show data assigned only to that user with respect to dept and company. 

one user can have multiple acess like same company but coukd ahve access to maybe 2 dept , power bi should consider all this.

DOMAIN EXCEL:

DOMAIN EXCELDOMAIN EXCEL

 

 

 MAIN EXCEL: 

MAIN EXCELMAIN EXCEL

1 ACCEPTED SOLUTION
vojtechsima
Super User
Super User

Hello, @sms2000

in your RLS settings to your RLS table, write [EMAIL]=USERPRINCIPALNAME().

 

Then create a new column which weill be concatening Company and Dept together (this is optional, you can use as the key any of those withour creating new one), do it in your MAIN Excel and your RLS table, then create relationshisp Many to Many but don't make it both, but RLS filters MAIN EXCEL, key column is the new one.

 

and then whenever you use Company or Dept, use it from the RLS tabel as dimension.

View solution in original post

8 REPLIES 8
vojtechsima
Super User
Super User

Hello, @sms2000

in your RLS settings to your RLS table, write [EMAIL]=USERPRINCIPALNAME().

 

Then create a new column which weill be concatening Company and Dept together (this is optional, you can use as the key any of those withour creating new one), do it in your MAIN Excel and your RLS table, then create relationshisp Many to Many but don't make it both, but RLS filters MAIN EXCEL, key column is the new one.

 

and then whenever you use Company or Dept, use it from the RLS tabel as dimension.

YESS this is worked perfectly. Thank you @vojtechsima 

@sms2000 Glad, it's working, kudos appreciated. thank you

 
PijushRoy
Super User
Super User

Hi @sms2000 

Please find the video to details - https://www.youtube.com/watch?v=jphj40tBPD8 

Please implement RLS in DOMAIN EXCEL table as explained in video. Create relationship with COMPANY column or or other lookup column. 
If solve, mark as solved




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





i have done the same with respect to "COMPANY" that is an active relationship in my model, but i also want power bi to filter the data according to DEPT as well 

 

i have tried to use LOOKUPVALUE but it does not seem to work 

 

how do i make power bi check the dept associated with the user's email and show only that data 

Uzi2019
Super User
Super User

Hi @sms2000 
Try to make active relationship between Dept (domain) 1-> Dept(Main) many.
I hope this solve your issue.

If I answered your question.Please give kudos and accept it as a solution!
Thanks

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

i can only make one relationship active between 2 tables , in this case company is active, whichever relationship is active the RLS filters for it . 

Hi @sms2000 

You can keep another inactive relation between two table and use RELATEDTABLE dax as per your requirement.

Thanks




Did I answer your question? Mark my post as a solution!
Appreciate your Like/Kudos

Proud to be a Super User!





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