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
RobbeVL
Impactful Individual
Impactful Individual

RLS

Hi,

 

I have a question regarding to Row Level Security.

I have successfully set up a RSL by using a bridge table and a relationship.

 

But some individuals have access to ALL data, how can I add this to my RLS Dax measure?
So now I have :

[Mail] = USERPRINCIPALNAME()

The bridgetable contains Mail & Unit.
When the username has "All" as Unit, it shouldnt filter
When it has something else, it should filter on Unit.

Any help?

 

Robbe

1 ACCEPTED SOLUTION

Hi @RobbeVL ,

 

You can try to use the following DAX to filter RLS.

 

VAR t =
    FILTER ( User, [Mail] = USERPRINCIPALNAME () )
VAR u = [Unit]
RETURN
    IF ( CONTAINS ( t, [Unit], "ALL" ), TRUE (), CONTAINS ( t, [Unit], u ) )

BTW, pbix as attached.

 

Best regards,

 

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

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

View solution in original post

3 REPLIES 3
v-lid-msft
Community Support
Community Support

Hi @RobbeVL ,

 

You can try to use the following DAX to filter RLS, but remember that people who have edit permission will always see the all data regardless of the filter.

 

VAR u =
    LOOKUPVALUE ( 'User'[Unit], 'User'[Mail], USERPRINCIPALNAME () )
RETURN
    IF ( u = "ALL", TRUE (), [Unit] = u )

RLS-1.png

 

BTW, pbix as attached.

 

Best regards,

 

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

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RobbeVL
Impactful Individual
Impactful Individual

Hi,

 

This almost works, What I might nog have mentioned is the following:

Some users are allowed to see multiple units. So my data looks like:

 

'AccessList'

Unit1 --- Angela@xx.com

Unit2 --- Angela@xx.com

 

 

'BU_List'

Unit 1

Unit 2

Unit 3

 

LOOKUPVALUE can only return 1 value, so it gives me an error when I view as a person who can see multiple Units.

Any workaround?

 

Robbe

 

Hi @RobbeVL ,

 

You can try to use the following DAX to filter RLS.

 

VAR t =
    FILTER ( User, [Mail] = USERPRINCIPALNAME () )
VAR u = [Unit]
RETURN
    IF ( CONTAINS ( t, [Unit], "ALL" ), TRUE (), CONTAINS ( t, [Unit], u ) )

BTW, pbix as attached.

 

Best regards,

 

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

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

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.