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
dgdgdg122db
Helper II
Helper II

Countx returns unexpected result

Hi ,

I want to count No. of customers who occurred once and more than 1 once.

First I have a calculated column : 

Order occurrence = COUNTX(
FILTER('Unique Order customer',
EARLIER('Unique Order customer'[Customer No.])='Unique Order customer'[Customer No.]) ,
'Unique Order customer'[Customer No.])
 
For the occurrence =1, 
First Time Buyers = COUNTX(FILTER('Unique Order customer','Unique Order customer'[Order occurance]=1),'Unique Order customer'[Customer No.])
and this gives me the correct result.
 
However, when I switch to more than 1, the result is not what I want.
Returning Customers = COUNTX(FILTER('Unique Order customer','Unique Order customer'[Order occurance] >1),'Unique Order customer'[Customer No.])
 
as in the card visual, it shows 30, but it is actually only 8 customers 
111111.PNG
2 ACCEPTED SOLUTIONS
brigittagemes
Helper I
Helper I

Hi @dgdgdg122db ,

 

try DISTINCTCOUNT

 

https://docs.microsoft.com/en-us/dax/distinctcount-function-dax

 

use it in a measure.

 

Yours sincerely,

 

Brigi

View solution in original post

v-xicai
Community Support
Community Support

Hi @dgdgdg122db ,

 

As brigittagemes 's suggestion, you may create the [Order occurrence] using measure instead of calculated column like DAX below.

 

Order occurrence=DISTINCTCOUNT('Unique Order customer'[Customer No.])

 

Best Regards,

Amy

 

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

View solution in original post

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi @dgdgdg122db ,

 

As brigittagemes 's suggestion, you may create the [Order occurrence] using measure instead of calculated column like DAX below.

 

Order occurrence=DISTINCTCOUNT('Unique Order customer'[Customer No.])

 

Best Regards,

Amy

 

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

brigittagemes
Helper I
Helper I

Hi @dgdgdg122db ,

 

try DISTINCTCOUNT

 

https://docs.microsoft.com/en-us/dax/distinctcount-function-dax

 

use it in a measure.

 

Yours sincerely,

 

Brigi

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.