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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Applicable88
Impactful Individual
Impactful Individual

Counting distinct without blanks of another field

Example =
Hello,
Hello,
I have two conditions for a distinctcount of ordernumbers: Duration lower then 60 and no blank fields in the duration column . Since distinctcount gives me no filter options I tried with countx and filter function:
 
COUNTX(
FILTER('Table1',
Table1[Duration]<> blank()
&& 'Table1'[Duration] < 60
),[Orders]
)

Applicable88_1-1639424902704.png

Havin these conditions, I should also count those orders with 0 duration, since they aren't blank. Why it only counts the duration lower then 60 but not the 0's?

Hope someone can clarify.

Thank you very much in advance. 

Best. 

2 ACCEPTED SOLUTIONS
bcdobbs
Community Champion
Community Champion

In DAX BLANK() = 0 evaluates to true which causes your issue.

 

Have a read of Be Careful When Filtering for Blanks in DAX — ehansalytics

 

Replace:

Table1[Duration]<> blank()
with NOT ISBLANK ( Table1[Duration] )

 

If you wanted to use DISTINCTCOUNT you could wrap it in a CALCULATE statement to add the filters you need.





Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

Syndicate_Admin
Administrator
Administrator

In my humble opinion and the years I have been for PBI, if it does not affect me to change all whites to -1 I would do it, since I have not been able to find a way for PBI to understand or differentiate which data is white and which data is 0.

I do it like this:

Ivancito111_0-1639426499501.png

And you'd just have to leave out the -1 values and you're done.

If this post answers your question, please mark as "Accept as a solution" so that other people can also access it.

Best regards

Ivancito

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

In my humble opinion and the years I have been for PBI, if it does not affect me to change all whites to -1 I would do it, since I have not been able to find a way for PBI to understand or differentiate which data is white and which data is 0.

I do it like this:

Ivancito111_0-1639426499501.png

And you'd just have to leave out the -1 values and you're done.

If this post answers your question, please mark as "Accept as a solution" so that other people can also access it.

Best regards

Ivancito

@Syndicate_Admin thats a good idea to tidy up the data in the first place. I really didn't know that PowerBi treats blank()=0 like in the information @bcdobbs  provided. 

 

bcdobbs
Community Champion
Community Champion

In DAX BLANK() = 0 evaluates to true which causes your issue.

 

Have a read of Be Careful When Filtering for Blanks in DAX — ehansalytics

 

Replace:

Table1[Duration]<> blank()
with NOT ISBLANK ( Table1[Duration] )

 

If you wanted to use DISTINCTCOUNT you could wrap it in a CALCULATE statement to add the filters you need.





Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

@bcdobbs thank you! Thats what drove me crazy 🙂

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors