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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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