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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors