Forum Discussion
Urgent HELP needed!!!
- 2 years ago
Hi Anonymous
You can use this DAX pattern from SQL BI for the Lost Customers for what you are looking for: Calculate New, Returning, Lost, and Recovered Customers in #dax - SQLBI
- Anonymous2 years ago
Hi Anonymous ,
Thanks for the reply from GilbertQ , please allow me to provide another insight:
1. Create a measure to get the number of customers whose revenue and quantity were not zero in the previous year.
previous year total = CALCULATE(DISTINCTCOUNT('Sample table'[Customer ID]),FILTER(ALL('Sample table'),'Sample table'[T-DI-A: Calendar Year] = SELECTEDVALUE(' Sample table'[T-DI-A: Calendar Year]) - 1 && 'Sample table'[Total Revenue] <> 0 && 'Sample table'[Total Volume - Liters] <> 0))2. Create a measure to get the churn customers.
churn customers = VAR _pre_revenue = CALCULATE(SUM('Sample table'[Total Revenue]),FILTER(ALL('Sample table'),'Sample table'[T-DI-A: Calendar Year] = SELECTEDVALUE('Sample table'[T-DI-A: Calendar Year]) - 1 && 'Sample table'[Customer ID] = MAX('Sample table'[Customer ID]) )) RETURN IF(_pre_revenue <> 0 && SUM('Sample table'[Total Revenue]) = 0,1,0)3. Put churn customers into the filter to show the data with result 1.
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous ,
Thanks for the reply from GilbertQ , please allow me to provide another insight:
1. Create a measure to get the number of customers whose revenue and quantity were not zero in the previous year.
previous year total =
CALCULATE(DISTINCTCOUNT('Sample table'[Customer ID]),FILTER(ALL('Sample table'),'Sample table'[T-DI-A: Calendar Year] = SELECTEDVALUE(' Sample table'[T-DI-A: Calendar Year]) - 1 && 'Sample table'[Total Revenue] <> 0 && 'Sample table'[Total Volume - Liters] <> 0))
2. Create a measure to get the churn customers.
churn customers =
VAR _pre_revenue = CALCULATE(SUM('Sample table'[Total Revenue]),FILTER(ALL('Sample table'),'Sample table'[T-DI-A: Calendar Year] = SELECTEDVALUE('Sample table'[T-DI-A: Calendar Year]) - 1 && 'Sample table'[Customer ID] = MAX('Sample table'[Customer ID]) ))
RETURN
IF(_pre_revenue <> 0 && SUM('Sample table'[Total Revenue]) = 0,1,0)
3. Put churn customers into the filter to show the data with result 1.
If your Current Period does not refer to this, please clarify in a follow-up reply.
Best Regards,
Clara Gong
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.