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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Womkas_90
Regular Visitor

DAX: how to count distinct date events where correlated columns are not blank?

Hello dear Community,

 

im pretty new to PowerBI and DAX and i have a particular Problem i cant solve.

I wanted to create a Measure which counts the distinct Date events, where units where sold. Therefore i am Expecting 2, because there are 3 Dates where stuff is sold, but the 01.12.2020 units sold value is blank.

 

 

Customer IDOrder IDProductUnits SoldDateRevenueCost
2183779Oatmeal Raisin 01.12.202030751353
3580583Oatmeal Raisin 01.12.202095804215.2
2707082Oatmeal Raisin 01.12.202062502750
2734809Oatmeal Raisin        1'23601.11.202061802719.2
2544809Oatmeal Raisin           94101.11.202047052070.2
3170867Oatmeal Raisin        1'14301.10.202057152514.6
4131700Oatmeal Raisin        1'26901.10.202063452791.8

 

Therefore i tried the following Measure: 

 

countdistinctdays = CALCULATE(DISTINCTCOUNT(Orders[Date].[Date]);'Orders'[Units Sold] = BLANK())

 

But what comes out is gibberish. Can someone help me here? I think i havent understood something fundamental in PowerBI.

 

 

Thank you very much!!! P.S. sorry for my english.

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Womkas_90 
Please try 

=
COUNTROWS (
    FILTER (
        VALUES ( Orders[Date] ),
        CALCULATE ( SUM ( Orders[Units Sold] ) ) <> BLANK ()
    )
)

View solution in original post

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @Womkas_90 

 

You can also try the following methods.

countdistinctdays =
CALCULATE (
    DISTINCTCOUNT ( Orders[Date] ),
    FILTER ( ALL ( Orders ), 'Orders'[Units Sold] <> BLANK () )
)

vzhangti_0-1662534516689.png

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

tamerj1
Super User
Super User

Hi @Womkas_90 
Please try 

=
COUNTROWS (
    FILTER (
        VALUES ( Orders[Date] ),
        CALCULATE ( SUM ( Orders[Units Sold] ) ) <> BLANK ()
    )
)

Yes it works, thank you so much!!!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.