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
Anonymous
Not applicable

Row Level Security not working for users with no role

I have dynamic row level security set up in my report that works in a sort of hierarchical sense where you are given access at one of three levels. I have included the DAX for each level below:

 

Top Level:
VAR _t =
CALCULATETABLE (
VALUES ( 'Access_Table'[Access_Required] ),
FILTER ( 'Access_Table', 'Access_Table'[User_Email] = USERPRINCIPALNAME () )
)
RETURN
IF (
CONTAINS ( _t, 'Access_Table'[Access_Required], "National" )
|| CONTAINS ( _t, 'Access_Table'[Access_Required], "Regional" )
|| CONTAINS ( _t, 'Access_Table'[Access_Required], "Individual" ),
'TableA'[Company]
IN CALCULATETABLE (
VALUES ( 'Access_Table'[Compan] ),
FILTER ( 'Access_Table', 'Access_Table'[User_Email] = USERPRINCIPALNAME () )
),
TRUE()
)

Middle Level:

IF(
CONTAINS(
CALCULATETABLE(
VALUES( 'Access_Table'[Access_Required] ),
FILTER( 'Access_Table', 'Access_Table'[User_Email] = USERPRINCIPALNAME() )
),
'Access_Table'[Access_Required], "Regional"
),
'TableB'[Region]
IN CALCULATETABLE (
VALUES( 'Access_Table'[Region]),
FILTER('Access_Table','Access_Table'[User_Email] = USERPRINCIPALNAME() )
),
TRUE()
)

Bottom Level:
IF(
CONTAINS(
CALCULATETABLE(
VALUES( 'Access_Table'[Access_Required] ),
FILTER( 'Access_Table', 'Access_Table'[User_Email] = USERPRINCIPALNAME() )
),
'Access_Table'[Access_Required], "Individual"
),
'TableC'[AGENCY]
IN CALCULATETABLE (
VALUES( 'Access_Table'[Agent_ID]),
FILTER('Access_Table','Access_Table'[User_Email] = USERPRINCIPALNAME() )
),
TRUE()
)


All three queries refer to an access table which basically consists of the relevant information needed to filter the report. The problem I have is that when a user is not contained in the access table they are able to view all data in the report.

 

Is there an error in the DAX that is allowing this to happen?

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

_t will return blank value when a user is not contained in the access table. It will always return TRUE in your original IF() formula. 

So you need to replace TRUE() with FALSE() or BLANK().

 

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

View solution in original post

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

_t will return blank value when a user is not contained in the access table. It will always return TRUE in your original IF() formula. 

So you need to replace TRUE() with FALSE() or BLANK().

 

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

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.