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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Shantanu3006
New Member

Implementing RLS in Power BI

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.

 

CountryNameEmaild IDClient
USAemailid1ALL
GermanyAemailid1KLM
GermanyAemailid1ABC
USBemaild2PQR
GermanyCemaild3HIJ

 

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

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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())

vyangliumsft_0-1729588476611.png

2. Result:

vyangliumsft_1-1729588476612.png

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

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())

vyangliumsft_0-1729588476611.png

2. Result:

vyangliumsft_1-1729588476612.png

 

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

AmiraBedh
Super User
Super User

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 ?

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.