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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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!

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 Kudoed Authors