Forum Discussion
Lost Customer Analytics
Hello all,
I've been testing a measure to analyze lost customers but it is not working correctly.
The measure I am using is:
For this specific customer the last and only sales was on 15th january 2021.
Therefore it should be marked as lost 6 months from now, so August. But why is it also showing for the months after August? Need to remove these
Thank you in advance
Hi Anonymous ,
Because the date range you set in the "CustomersPurchased" variable is from the previous year to the half of the previous year, so the calculation results in 8/2020 - 1/2021 will include CustomerCode 11.
You can try the following formula:
Advanced Lost Customers = var CustomersPurchased = CALCULATETABLE( DISTINCT(transactions[CustomerCode]), FILTER( ALL('transactions'), 'transactions'[Date] >= EDATE( MIN('Calendar'[Date]), -7) && 'transactions'[Date] < EDATE( MIN('Calendar'[Date]), -6) ) ) var PriorCustomers = CALCULATETABLE( DISTINCT(transactions[CustomerCode]), FILTER( ALL('transactions'), 'transactions'[Date] >= EDATE( MIN('Calendar'[Date]), -6) && 'transactions'[Date] < MIN('Calendar'[Date]) ) ) return COUNTROWS(EXCEPT(CustomersPurchased,PriorCustomers))*-1If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- v-kkf-msftCommunity Support
Hi Anonymous ,
Because the date range you set in the "CustomersPurchased" variable is from the previous year to the half of the previous year, so the calculation results in 8/2020 - 1/2021 will include CustomerCode 11.
You can try the following formula:
Advanced Lost Customers = var CustomersPurchased = CALCULATETABLE( DISTINCT(transactions[CustomerCode]), FILTER( ALL('transactions'), 'transactions'[Date] >= EDATE( MIN('Calendar'[Date]), -7) && 'transactions'[Date] < EDATE( MIN('Calendar'[Date]), -6) ) ) var PriorCustomers = CALCULATETABLE( DISTINCT(transactions[CustomerCode]), FILTER( ALL('transactions'), 'transactions'[Date] >= EDATE( MIN('Calendar'[Date]), -6) && 'transactions'[Date] < MIN('Calendar'[Date]) ) ) return COUNTROWS(EXCEPT(CustomersPurchased,PriorCustomers))*-1If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
WinnizIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.