Forum Discussion
CL7777
6 years agoHelper III
Counting repeat customers
HEllo Forum, I am an intermediate dax user and Im struggling with this task I want to count repeat customers in a table, keeping all filters applied in the visual. Example file customer ...
- 6 years ago
I see what you mean. Tricky this one, but I think I've cracked it.
Give this a try:
1) First measure:
Distinctcount years = CALCULATE(DISTINCTCOUNT('Customer data'[year]); ALLEXCEPT('Customer data'; 'Customer data'[Customer]; 'Customer data'[Country];'Customer data'[part number]))2) Final Measure to deliver repeating customers:
Repeating Customers = CALCULATE(DISTINCTCOUNT('Customer data'[Customer]); FILTER(ALL('Customer data'[Customer]); [Distinctcount years]>1)) +0
CL7777
6 years agoHelper III
Thanks for your repsonse. This is not exactly working because it calculates the number of repeat customers, but not if I were to filter by product for example. The first measure you wrote calculates the number of years that each customer purchased something but it would need to count the number of years that each customer purchased a particular part. When I filter by part in the visual, it doesnt work.
PaulDBrown
6 years agoCommunity Champion
I see what you mean. Tricky this one, but I think I've cracked it.
Give this a try:
1) First measure:
Distinctcount years = CALCULATE(DISTINCTCOUNT('Customer data'[year]);
ALLEXCEPT('Customer data';
'Customer data'[Customer]; 'Customer data'[Country];'Customer data'[part number]))2) Final Measure to deliver repeating customers:
Repeating Customers = CALCULATE(DISTINCTCOUNT('Customer data'[Customer]);
FILTER(ALL('Customer data'[Customer]);
[Distinctcount years]>1)) +0