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
jeben
Helper I
Helper I

Using not equal Blanks in DAX not returning correct total

Hello,

I am using this DAX statement for a measure:  

n value = CALCULATE(COUNTROWS('Donor NPS'),FILTER('Donor NPS',[NPS]<>BLANK()))
 
I then use "n value" as the Value in a matrix, with no rows, but "Year-month" as the columns for the matrix.  Below is a screenshot of the matrix and the values, with August, 2023 circled:
jeben_0-1700503180833.png

 

Yet when I go into the table view of the "Donor NPS" table, and filter on "Year-month" = 2023-08, & filter on "NPS" = all values checked except Blanks, it counts 3513 filtered rows.  See screenshot below.  

jeben_1-1700503386065.png

 

Why using the same criteria, does the DAX statement return a value of 3475 and filtering the table view counts 3513?  

 

John

1 ACCEPTED SOLUTION

The COUNT will iterate only on the specified column, while COUNTROWS considers the whole table. That can make the difference to narrow down the problem. Glad it worked for you 🙂 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





View solution in original post

5 REPLIES 5
jeben
Helper I
Helper I

Thanks, I tried your first suggestion with the same result.  The second gave me the error below in display of the visual:  

jeben_0-1700519622099.png

We have some sensitive data in the application so I don't think I can share the whole pbix (which is 9MB).  Can I share a portion of it with you?  Would that help?  

 

Any other suggestions?

John

Hi again, 

I tried one other thing, your suggestion to use:  n value1 = CALCULATE(COUNT(Donor NPS[NPS]), Donor NPS[NPS] <> BLANK())   except I took out the filter and now it matches what I had in the data table view.  I'm thinking that the COUNT function maybe doesn't include blanks for a whole number field?

 

John

The COUNT will iterate only on the specified column, while COUNTROWS considers the whole table. That can make the difference to narrow down the problem. Glad it worked for you 🙂 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super User!





Hi @jeben 

 

Maybe try replacing 'Donor NPS'[NPS] <> BLANK() with  NOT ISBLANK( 'Donor NPS'[NPS] )

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
ray_aramburo
Super User
Super User

Is it possible for you to share your .pbix file? 

In the meantime, other suggestions would be to try the following measures:

n value1 = CALCULATE(COUNT(Donor NPS[NPS]), Donor NPS[NPS] <> BLANK())

or

n value1 = CALCULATE(COUNT(Donor NPS[NPS]), Donor NPS[NPS] <> "")

 





Did I answer your question? Give your kudos and mark my post as a solution!

Proud to be a Super 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 Kudoed Authors