Forum Discussion

Khalidc's avatar
Khalidc
Frequent Visitor
4 years ago

Lost customers

Hi 

I try to calculate the lost customers over time in a specific week. I feel like I am almost there but cannot get it to work. I am for sure overseeing something in the measure, hopefully you can help.

The assumption used it that all customers who have a last sale older than 12 weeks should be considered lost. The measure should be able to present the lost customer in a stack column chart but also show which customers are lost in a matrix table when selecting the period in the chart.

 

# lost customers week = 
var SelectedWeek = SELECTEDVALUE('FS_Vertaling weken naar perioden'[Index - week])

var allcustomers = values(FS_Omzet_uren_all[Groepnaam]) --take all customers
var customerinactiveperiod = CALCULATETABLE( values(FS_Omzet_uren_all[Groepnaam]), --select all customers who match below filter
filter( all( 'FS_Vertaling weken naar perioden'), --remove all date filters
'FS_Vertaling weken naar perioden'[Index - week] > SelectedWeek-12 &&
'FS_Vertaling weken naar perioden'[Index - week] < SelectedWeek)) --take all customers with sales in the last 12 weeks

return

COUNTROWS(
EXCEPT(allcustomers,customerinactiveperiod)) --take all customers and remove all active customers (customers in active period)

This is what I get:

This is what I would expect:

 

2 Replies