Forum Discussion

jcawley's avatar
jcawley
Helper III
6 years ago

Lost Customers

Hello all,

I'm trying to find the number of customers who are 'lost' for any given month!

 

Lost = The number of customers who have not completed an appointment in 24 months but who have purchased before.

I have 3 tables: Dates, Appointments, and a Has Purchased Before table. Appointments and Has Purchased are linked by Customer ID. Appointments has a column called 'Status' that needs to read 'Completed'. Has Purchased Before table is just a list of folks who  have bought from us.

I tried repurposing a solution I found here on the forums but it isn't looking at Appointments[Status] = "Completed" or if the Patient pops up in the Has Purchased Before table.

So far the repurposed measure looks like this:

 

Lost Customers =
VAR __24mosago =
EDATE ( MIN ( 'Dates'[Date] ), -24 )
VAR __25mosago =
EDATE ( MIN ( 'Dates'[Date] ), -25 )
RETURN
COUNTROWS (
FILTER (
ALLSELECTED (Appointments[Date] ),
AND (
ISBLANK (
CALCULATE ( COUNTROWS ( Appointments), ALL ( 'Dates' ), 'Dates'[Date] >= __24mosago )
),
NOT (
ISBLANK (
CALCULATE ( COUNTROWS ( Appointments), ALL ( 'Dates' ), 'Dates'[Date] >= __25mosago )
)
)
)
)
)


Any help would be greatly appreciated!
 

3 Replies