Forum Discussion
RLS with Page level security
I created a main page and two pages in the same report. Page A and Page B
main summary table contains all the data including fields region
I created a file PLS.txt with columns
| username | report | region |
| [email protected] | page A | CA |
| [email protected] | page A | DC |
| [email protected] | page B | WA |
| [email protected] | page B | IL |
On row level security I created a new PLS role and put as
[username] = USERPRINCIPALNAME()
This worked and assigned usernames only able to view either Page A or Page B from main page.
Now I want to restrict usernames to only view the region that they are assigned.
How should I do it?
- Anonymous2 years ago
Hi gsk135
amitchandak Thank you very much for your prompt reply. Here please allow me to post some of my content.
To restrict users to view only the regions they are assigned to in Power BI, you need to enhance the RLS settings by adding additional DAX filters that correspond to the regions.
In Power BI Desktop, go to the Modeling tab and select Manage Roles. Create a role for each region and define a DAX filter expression to check the username and region.
For each role, you need to create a DAX expression that matches the region field to the region assigned to the user.
[username] = USERPRINCIPALNAME() && [Region] in SELECTCOLUMNS(FILTER('Table', [username] = USERPRINCIPALNAME()), "Region", [region])After you define roles and rules in Power BI Desktop, publish the report to the Power BI service.
By performing these steps, you can ensure that users can only view data assigned to their zones based on the RLS policies you set.
Row-level security (RLS) with Power BI - Power BI | Microsoft Learn
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandakSuper User
gsk135 , Join this table with region in table or dimension. and this table should filter table or dimension (in case of many many join)
Then the above role will filter regions too
How to use Row Level Security (RLS): https://youtu.be/NfdIA0uS6Nk
- AnonymousNot applicable
Hi gsk135
amitchandak Thank you very much for your prompt reply. Here please allow me to post some of my content.
To restrict users to view only the regions they are assigned to in Power BI, you need to enhance the RLS settings by adding additional DAX filters that correspond to the regions.
In Power BI Desktop, go to the Modeling tab and select Manage Roles. Create a role for each region and define a DAX filter expression to check the username and region.
For each role, you need to create a DAX expression that matches the region field to the region assigned to the user.
[username] = USERPRINCIPALNAME() && [Region] in SELECTCOLUMNS(FILTER('Table', [username] = USERPRINCIPALNAME()), "Region", [region])After you define roles and rules in Power BI Desktop, publish the report to the Power BI service.
By performing these steps, you can ensure that users can only view data assigned to their zones based on the RLS policies you set.
Row-level security (RLS) with Power BI - Power BI | Microsoft Learn
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.