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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
ebee
Helper I
Helper I

RLS + filter out nulls

Hi,

Let's say I have a DimOrganizations table that is affected by RLS. It has a one to many relationship to some Fact table via org_id column. Now, the Fact table has some nulls in its org_id. By default, it seems the nulls are always shown, no matter how the dim is filtered by the rls. How would you prevent that? Should I

  • Convert null org_id values into -1 and create some custom DimOrganization for that id
  • Do a bunch of table filters for the rls role to discard nulls from various fact tables
  • Something else

Thanks in advance

1 ACCEPTED SOLUTION

Oh!! You are correct. In a normal RLS role, nulls are not shown.

 

I think I found a bug. If you filter a user table with RLS dax ie. containsstring( username(), [user] ), it will show all nulls from any linked fact tables.

 

Using 

containsstring( username(), [user] ) && not( isblank( [user] ))
fixes it.

View solution in original post

3 REPLIES 3
Smalfly
Responsive Resident
Responsive Resident

Hi @ebee ,

 

that is strange. According to my experience, the default is that null values are always filtered out by RLS.

Are you sure your RLS is doing what it is supposed to do apart from the null values? Hence, that everything has been set-up correctly?

 

If so, can you please share some sample data with us?

Oh!! You are correct. In a normal RLS role, nulls are not shown.

 

I think I found a bug. If you filter a user table with RLS dax ie. containsstring( username(), [user] ), it will show all nulls from any linked fact tables.

 

Using 

containsstring( username(), [user] ) && not( isblank( [user] ))
fixes it.

It is easy to create a test using enter data which confirms nulls are kept.

Kimball recommends to never have nulls on foreign keys so maybe I'll go with that. I'll replace nulls with -1 or something and create a corresponding dimension row for that labeled "Undefined".

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.