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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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