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
Oceans88
Helper III
Helper III

RLS / Multiple Categories

Hi All,

 

Im trying to figure out this dynamic RLS problem that i have. I want a simple RLS User table to filter allowed content using USERPRINCIPLENAME(). 

 

Example: In the case of a@aaa.com user should be seeing data only related to the following criteria: 

Peru/Finland/BU1/BU2/EPC

 

RLS User Table

Oceans88_0-1593522618583.png

 

Data Table

Oceans88_1-1593522956035.png

 

Anyone has an idea of how to acomplish this? 

 

Thanks in advance for any possible help. 

Kr

 

6 REPLIES 6
v-diye-msft
Community Support
Community Support

Hi @Oceans88 

 

If there's relationship exited between RLS User Table and Data table and assuming the related column is A in RLS table, B in Data table, you should specify the related column in the DAX expression such as:

 

[B] = MAXX(filter(RLS User Table,[Email] = USERPRINCIPALNAME()),[A])

 

here's also other blogs could be your reference:

https://radacad.com/dynamic-row-level-security-with-manager-level-access-in-power-bi

https://radacad.com/dynamic-row-level-security-with-organizational-hierarchy-power-bi

https://radacad.com/dynamic-row-level-security-with-power-bi-made-simple

 

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

Hi v-diye-msft,

 

Thank you for the link. Greatly apreciated. I have it somewhat working at the moment but i have an issue. 

I have 3 diffrent filtering criteria Country/BU/ INL. At the moment each user needs to information for each one of the criterias for RLS to work. If its missing one of the criterias it will show no data for the person. 

 

Example:

User: A@aa.com

User table: Sweden/BU1/EPC

This is working fine.

 

User: A@aa.com

User table: Sweden/BU1/

Instead of seeing as above, he/she will see nothing because its missing the INL information (EPC)

 

 

I have one Role with some code in each of the filtering tables

 
 

image.png

 

How can i modify this code to allow it to filter if one of the users is missing one of the 3 requierd criteria ?

Maybe som how :

 

If(Users[2-BU]=Blank(), Ignore,

CONTAINS (
Users,
Users[Email],
USERPRINCIPALNAME(),
Users[2-BU],
[BU]
)
||
CONTAINS (
Users,
Users[Email],
USERPRINCIPALNAME(),
Users[4-Global],
"Admin")

 

What do you think? 

 

 

 

The model

Oceans88_0-1593682322115.png

 

Just bumping up to see if anyone has any comments on my previous post. 

 

Kind regards

No Ideas, If there is something unclear just let me know and will clarify as best as possible

Pragati11
Super User
Super User

Hi @Oceans88 ,

 

Chek if the following thread helps:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dynamic-RLS/m-p/1180195

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi Pragati, Thanks for sharing the link. No, i have tried and i can not det it to work. I have seen this post before. Any more ideas on how to accomplish? 

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.