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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jdusek92
Helper IV
Helper IV

Row level security and relationship

Hello,

I have this data model:

2019-04-02 16_14_23-Untitled - Power BI Desktop.png

relationship model:

2019-04-02 16_15_16-Untitled - Power BI Desktop.png

 

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:

2019-04-02 16_24_15-Untitled - Power BI Desktop.png

 

 

But when I tick "Apply security filter in both directions", it filters all the tables:

2019-04-02 16_19_51-Untitled - Power BI Desktop.png

 

2019-04-02 16_22_11-Untitled - Power BI Desktop.png

 

My question:

  1. Why do I have to tick "Apply security filter in both directions" for the second relationship, but and not for the first
  2. 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 8
v-danhe-msft
Employee
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

https://docs.microsoft.com/en-us/power-bi/service-admin-rls#define-roles-and-rules-in-power-bi-deskt...

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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:

2019-04-03 12_13_51-test - Power BI Desktop.png

 

How can I work this around ? I want to filter all the tables based on a record in "Employees" table.

 

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. 

1.PNG

Reference:

https://docs.microsoft.com/en-us/power-bi/desktop-create-and-manage-relationships#adjusting-cross-fi...

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-danhe-msft , thank you for your research. the reference is very helpful, but still:

 

I understand that I cannot create circular relationships like you show show in the picture.

According to your reference it is recommended to use a Star Schema:

2019-04-09 16_59_45-Create and manage relationships in Power BI Desktop - Power BI _ Microsoft Docs.png

 

In my opinion I am using this type of schema, I do not have any circular relationships:

2019-04-03 12_13_51-test - Power BI Desktop.png

Yet I cannot use RLS filtering from EMPLOYEES table to filter BOTH look-up tables (JOBS and CHAIRS). I can be set to filter only one at a time. I need all the related tables to be filtered by RLS

 

Example pbix is attached here:

https://drive.google.com/open?id=1Y0sYDcSULkRQGpYWv9nfMzaOVzWFrozo

Try view as role:

2019-04-09 17_14_12-.png

 

Maybe this is a limitation of Row Level Security / Roles ? 

 

Regards,

Jakub

 

Anonymous
Not applicable

@jdusek92  you added 4 seperate tables and viewing them seperately. You dont visualize data like that right.

   Just add columns from all 4 tables into one table(visual) and see.....

Anonymous
Not applicable

HI,

 

   I have the same issue. Did you get any solution on this

To be sure, I include a UserPrincipalName column in each table and set up a role filtering for each table. Also I eliminate the tables that cannot be enriched with UPN column (like Job Catalog)  - data from such tables must be therefore merged+expanded to main datatables. Otherwise I cannot be sure that unwanted information will be hidden.

Anonymous
Not applicable

Thanks for your quick reply. But when we have a lookup tables it will be difficult to bring the UserName or UserPrincipal to lookup tables. I think I have a different issue, so I have created another thread here

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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