Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Environment is Power BI embedded and Azure SQL
One table has all customer company data contain customer company code and users will access common Power BI Report. Login ID does not contain company code.
I want to show to user there company data that is match customer company code linked to login ID.
What should I do?
Solved! Go to Solution.
Hi @Anonymous,
For your scenario, you can set up your RLS fitler on company_code filed.
Lookup company_code based on current username, then use this as filter parameter to apply on company_code field.
Sample formula:
[company_code] = LOOKUPVALUE ( 'Table'[company_code], 'Table'[login_Id], USERPRINCIPALNAME () )
Regards,
Xiaoxin Sheng
Hi @Anonymous,
I'd like to suggest you to take a look at below link about RLS with username:
Add company code to user table to link company id with username and use this column to create relationship to other tables. Then you can use logined users to achieve dynamic rls filter.
Regards,
Xiaoxin Sheng
Hi Xiaoxin.
Thank you for reply. I tried to use RLS username() or userprincipalname() but the requeirments are racking my brain...
Table has data like below.
| company_code | login_Id | date | data |
| AAA | user01@contoso.com | 2018/1/1 | 10 |
| AAA | user01@contoso.com | 2018/2/1 | 20 |
| AAA | user02@contoso.com | 2018/1/1 | 10 |
| BBB | user03@oslo.com | 2018/1/1 | 20 |
| BBB | user04@oslo.com | 2018/1/1 | 30 |
| CCC | 2018/2/1 | 40 |
Requirements.
-Customer company has multiple user. "user01" and "user02" can see data linked "AAA".
-Some users have same domain but other company like subsidiary. So, "user01" and "user02" do not see data linked "CCC". "user05" can see only data linked "CCC".
-Domain does not necessarily include a company name or code.
So, I might be able to solve this matter if I could use customer company code linked to loginID for condition.
Would you have any good ideas?
Hi @Anonymous,
For your scenario, you can set up your RLS fitler on company_code filed.
Lookup company_code based on current username, then use this as filter parameter to apply on company_code field.
Sample formula:
[company_code] = LOOKUPVALUE ( 'Table'[company_code], 'Table'[login_Id], USERPRINCIPALNAME () )
Regards,
Xiaoxin Sheng
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 29 | |
| 23 | |
| 17 | |
| 16 | |
| 14 |