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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
mstone3
Helper III
Helper III

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?



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

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
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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.