March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi All
I am trying to implement the RLS in power BI. What I want to implement is the security at the country and the clients within the country. If a person belongs to a specific country, he should see the data of that country and the clients within the country he is entiltled to see.
Below is the user access table that I have in PBI. I also have country and client column in the fact table.
Country | Name | Emaild ID | Client |
US | A | emailid1 | ALL |
Germany | A | emailid1 | KLM |
Germany | A | emailid1 | ABC |
US | B | emaild2 | PQR |
Germany | C | emaild3 | HIJ |
Here, if a user 'A' logs on the report, he should see the data related to client 'KLM' and 'ABC' for Germany and he should see data of all the clients for the 'US'.
I tried to implement it with the filter on client and country with AND condition. It works with the scenarions where I dont have 'ALL' for clients.
Any help for this issue is greatly appreciated.
Thanks
Shantanu
Solved! Go to Solution.
Thanks for the reply from AmiraBedh , please allow me to provide another insight:
Hi @Shantanu3006 ,
Here are the steps you can follow:
1. Modeling – Manage Roles – Filter data -- Place the following formula .
When applying to multiple users, you can replace "A" with USERPRINCIPALNAME().
var _table1=
FILTER('Table','Table'[Name]="A")
var _Country=
SELECTCOLUMNS(_table1,"Country",[Country])
var _Email=
SELECTCOLUMNS(_table1,"email",[Emaild ID])
RETURN
IF(
[Emaild ID] in _Email || [Country] in _Country,TRUE(),FALSE())
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thanks for the reply from AmiraBedh , please allow me to provide another insight:
Hi @Shantanu3006 ,
Here are the steps you can follow:
1. Modeling – Manage Roles – Filter data -- Place the following formula .
When applying to multiple users, you can replace "A" with USERPRINCIPALNAME().
var _table1=
FILTER('Table','Table'[Name]="A")
var _Country=
SELECTCOLUMNS(_table1,"Country",[Country])
var _Email=
SELECTCOLUMNS(_table1,"email",[Emaild ID])
RETURN
IF(
[Emaild ID] in _Email || [Country] in _Country,TRUE(),FALSE())
2. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Why do you have the country and client columns in the fact table if the country already belongs to the client dimension ?
Can you share the design of your data model ?
User | Count |
---|---|
120 | |
77 | |
58 | |
52 | |
46 |
User | Count |
---|---|
171 | |
117 | |
63 | |
57 | |
51 |