Reply
DataSundowner
Helper II
Helper II
Partially syndicated - Outbound

RLS Retain Null Values for All Users

Hello everyone. I have a fact table with LocationID and a location dimention table that connects to LocationID in the facts table. Then I have a RLS table that has locationID and user email, and I'm joining the RLS table with the location dimention table. It works fine to show each user the locations of what they are supposed to see. However, there are also data without a locationID (nulls) in the fact table. What should I do if I want everybody to be able to see those data with null locationIDs in the fact table? Thanks! 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Syndicated - Outbound

Hmm, try it like this.

VAR _UPN = USERPRINCIPALNAME ()
RETURN
	'LocationDim'[locationID]
	IN CALCULATETABLE ( DISTINCT ( 'RLS'[locationID] ), 'RLS'[Email] = _UPN )
	|| ISBLANK ( 'LocationDim'[locationID] )

View solution in original post

6 REPLIES 6
jdbuchanan71
Super User
Super User

Syndicated - Outbound

Hmm, try it like this.

VAR _UPN = USERPRINCIPALNAME ()
RETURN
	'LocationDim'[locationID]
	IN CALCULATETABLE ( DISTINCT ( 'RLS'[locationID] ), 'RLS'[Email] = _UPN )
	|| ISBLANK ( 'LocationDim'[locationID] )

Syndicated - Outbound

@jdbuchanan71 This one worked! Thank you! 

jdbuchanan71
Super User
Super User

Syndicated - Outbound

@DataSundowner 

What if you disconnect the RLS table and apply the RLS rule to the LocationDim table like this.

 

VAR _UPN = USERPRINCIPALNAME ()
RETURN
    'LocationDim'[locationID]
        = LOOKUPVALUE ( 'RLS'[locationID], 'RLS'[Email], _UPN )
        || ISBLANK ( 'LocationDim'[locationID] )

 

 

Hi @jdbuchanan71 I tried what you suggested, but received the following error when I viewed as a user from RLS. 

 

DataSundowner_0-1667928257635.png

 

v-henryk-mstf
Community Support
Community Support

Syndicated - Outbound

Hi @DataSundowner ,

 

For data without a locationID (nulls) in the fact table. for the presence of other fields in the fact table, I think we should try to add a judgment condition to the formula to achieve this requirement.


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Syndicated - Outbound

Hi Henry. Thank you for your reply. Please see the screenshots below. My goal is to allow everyone in RLS table to be able to see data with null locationID in the fact table. 

 

DataSundowner_0-1667925698043.pngDataSundowner_1-1667925703075.pngDataSundowner_2-1667925709903.pngDataSundowner_3-1667925711876.pngDataSundowner_4-1667925716272.png

DataSundowner_5-1667925719456.png

 

avatar user

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)