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
mstone3
Helper II
Helper II

Strange issue with DAX formula and Row Level Security Role

Hello -

 

I have a basic table below.  The DAX formula for the measure is a simple COUNTROWS function:

Measure =COUNTROWS(Losses)

mstone3_0-1632505894177.png

 

I have a couple of blanks in the table and need those to be replaced with zeroes, so I add +0 to the formula and it works as desired:

 

Measure = COUNTROWS(Losses)+0

mstone3_1-1632506033789.png

 

However, when I apply a row level security role and view the visual as that role, the undesired blanks return, and the DAX formula has not been changed, it is still Measure = COUNTROWS(Losses)+0

 

mstone3_2-1632506109390.png

 

This is very strange - I don't understand what's going on here.  Thanks very much for your help!

 

 

 

4 REPLIES 4
Greg_Deckler
Super User
Super User

@mstone3 What is your RLS role definition in terms of its DAX formula?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler , 

 

The DAX formula for the role definition is [Level 2] = "NCTR"

 

Every row in the data has a 4 letter organizational acronym with column name "Level 2", so the role definition is just equal to the acronym. 

 

Thank you

@mstone3 So would all of those rows for FY17 Involuntary Losses be filtered out for NCTR role? I'll have to do some mocking up of data unless you can provide a sample in text.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Yes that's correct - all of those rows would be filtered out by the NCTR role.  Based on your question, it sounds like there is a difference between the way RLS works and the way a regular slicer/filter would work without a RLS role applied, such that:

 

+With an RLS role enabled for 'NCTR', there are no rows/no data to access, so nothing to compute with the COUNTROWS function and therefore no +0 to add, so therefore blank results.

 

+If no RLS role, but instead filtered to 'NCTR' using a slicer/filter, there are still rows available for the formula to 'see' and for the COUNTROWS function to compute and then add +0, so therefore result shows zero. (all of the tables shown in the thread were filtered to 'NCTR' using a slicer)

 

Does that sound like the right way to think about it?

 

Thanks!

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.