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

Calculate Number of Order Dates

AdventureWorks 2012 exampleAdventureWorks 2012 exampleWith AdventureWorks 2012, if you list customer name, order date and model number, the above customer data is listed with different order dates.  How do I count only once each unique order date, and then count the number of order dates per customer?

With the above example, Aaron coleman only ordered once and therefore the number of unique dates is ONE.  Aaron Collins also ordered more than one item, but ordered them on two unique dates and therefore the count for Aaron Collins is 2 order dates and so forth.

The answer should be as follows

Name                     Count of Order date

Aaron Coleman      1

Aaron Collins          2

Aaron Diaz              2

2 ACCEPTED SOLUTIONS
v-frfei-msft
Community Support
Community Support

Hi @surfingjoe ,

 

DISTINCTCOUNT should be your best choice. To create a measure using it.
 
Measure = DISTINCTCOUNT('Table1'[Order date])
Capture.PNG
 
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

Hi @surfingjoe ,

 

ALLEXCEPT should work here.

 

Measure = CALCULATE(DISTINCTCOUNT('Table1'[Order date]),ALLEXCEPT(Table1,Table1[Name]))

2.PNG

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @surfingjoe ,

 

DISTINCTCOUNT should be your best choice. To create a measure using it.
 
Measure = DISTINCTCOUNT('Table1'[Order date])
Capture.PNG
 
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

In its simplest form that works.  I originally stated this doesn't work, but I was wrong to say that, it did not work for me but my issue was not in the same context as the example given.  After more experience with Power BI and going back and reading my example and your solution, I realized that of course your solution is the right answer for my example.  Thank You

Hi @surfingjoe ,

 

ALLEXCEPT should work here.

 

Measure = CALCULATE(DISTINCTCOUNT('Table1'[Order date]),ALLEXCEPT(Table1,Table1[Name]))

2.PNG

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

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.