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
KasperBI
Frequent Visitor

Help with RLS

Hi Power BI

 

I'm sure that there is a tutorial for this type of RLS, I just don't know where to find it

 

I have the following tables:

User: a list of users (userID unique identificer) including e-mail

Access: A list of users (userID) and which accounts they should have access to. No unique key here necessarily. It will just have user 1, account 1, user 1, account 2, user 1, account 3, user 2, account 1, user 2, account 2 etc. Many users many accounts.

 

My fact table contains no userID, but contains accountID.

 

How do I set up RLS, in such a way that the fact table is filtered to the user logging in, and only being able to see their own accounts?

 

Thanks in advance

2 REPLIES 2
amitchandak
Super User
Super User

@KasperBI , You can have many to Many join on account, user id means email id should be used as filter on this table

 

In the role

email/userid = userprincipalname()

 

 

refer if needed

short video :How to use Row Level Security (RLS): https://youtu.be/NfdIA0uS6Nk

https://radacad.com/dynamic-row-level-security-with-organizational-hierarchy-power-bi
https://www.blue-granite.com/blog/using-dynamic-row-level-security-with-organizational-hierarchies

Hi @amitchandak 

 

It sort of works. 

 

I have set up 3 tables to test, 

1: Contains e-mail from user table

2: Contains e-mail from access table (user and accounts for that user)

3: fact-table, contains account.

 

There is a 1 to many relationship between table 1 and 2 (user e-mail), and a many to many relationship on account nr. between 2 and 3

 

When I filter table 1 by clicking on the table, table 2 and 3 filters correctly

When I filter the report page by inserting user email from table 1 into the filter pane table 2 and 3 filters correctly

When I test with RLS [UserEmail]=USERPRINCIPALNAME() table 1 & 2 filters correctly, but not table 3. Table 3 doesn't filter at all this way, even though in my mind I'm applying the exact same filter context in all 3 scenarios. What could be the cause?

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.