cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Flynn0327 Frequent Visitor
Frequent Visitor

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

Accepted Solutions
Highlighted
brigittagemes Frequent Visitor
Frequent Visitor

Re: Countx returns unexpected result

Hi @Flynn0327 ,

 

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

Community Support Team
Community Support Team

Re: Countx returns unexpected result

Hi @Flynn0327 ,

 

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
Highlighted
brigittagemes Frequent Visitor
Frequent Visitor

Re: Countx returns unexpected result

Hi @Flynn0327 ,

 

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

Community Support Team
Community Support Team

Re: Countx returns unexpected result

Hi @Flynn0327 ,

 

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

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors