Forum Discussion
Row level security and relationship
Hello,
I have this data model:
relationship model:
I want to use Row Level security via UserPrincipalName() expression.
I have set up a role for table Employees:
[UserPrincipalName] = userprincipalname()
When I view report as a specific user only two tables are filtered correctly:
But when I tick "Apply security filter in both directions", it filters all the tables:
My question:
- Why do I have to tick "Apply security filter in both directions" for the second relationship, but and not for the first?
- What exactly does this option do?
sample data here:
https://drive.google.com/file/d/1chwlT_cP3QPvMCC2IH2hxq-TkJhulTLb/view?usp=sharing
As you can see I want to use Power BI and Row Level Security for HR reporting with sensitive information. I want to be sure that employees cannot reach irrelevant data.
Warm regards,
Jakub
8 Replies
- v-danhe-msftMicrosoft Employee
Hi jdusek92 ,
This feature is for direct query and by default, the row-level security filtering uses single-directional filters, regardless of whether the relationships are set to single direction or bi-directional. You can manually enable bi-directional cross-filter with row-level security by selecting the relationship and checking the Apply security filter in both directions checkbox to apply bi-directional.
Reference:
https://docs.microsoft.com/en-us/power-bi/desktop-bidirectional-filtering
Regards,
Daniel He
- jdusek92Advocate III
Apply security filter in both directions does the trick indeed.
But when I want to have more tables and apply RLS to all of them, I am getting this error message:
How can I work this around ? I want to filter all the tables based on a record in "Employees" table.
- v-danhe-msftMicrosoft Employee
Hi jdusek92 ,
Based on my research, it is due to your relationship will result in a circle filtering that Power BI will not let to create a full circle of relationships between tables due to ambiguity in filtering.
Reference:
Regards,
Daniel He