Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Calculate New & Lost Customers

Hi,

I have a query where I need to find out new and lost customers monthly.

New - A customer which did not have a record in last month sales data.

Lost - A customer which had a record in last month's sales data but doesn't have one in this month.

I have found a few solutions on forum here, however, they are not giving me a monthly list, I need to select a month then the numbers come up for only those months. I am looking for solutions that I can work in expressions in the chart and not by making changes in the script.

A sample of my data is as below:

    

PRODUCTIDSALEIDCUSIDEXTRACTDATE
11101A30/06/2018
12102B30/06/2018
13103C30/06/2018
14104D30/06/2018
15105E30/06/2018
16106F30/06/2018
17107G30/06/2018
18108H30/06/2018
19109A31/05/2018
20110C31/05/2018
21111D31/05/2018
22112F31/05/2018
23113G31/05/2018
24114I31/05/2018
25115J31/05/2018
26116K31/05/2018
27117L31/05/2018
28118C30/04/2018
29119F30/04/2018
30120I30/04/2018
31121M30/04/2018
32122N30/04/2018
33123O30/04/2018
34124P30/04/2018

I want an output like:

   

ExtractDateNew CustomersLost Customers
30/04/201804
31/05/201864
30/06/201834

To explain further, the CUSID that we can't find in April becomes New Customers for May and so on. And the CUSID we can't find in May but are there in April becomes lost of April.

Please advise how can this be done within expression.

Thank You in Advance.

Regards,

Roopali

2 Replies
sunny_talwar

Why do you have 4 lost customers for Apr? Based on the data provided... we don't even know who was and who wasn't present in March (not available).... and similarly why do you have 0 for new customer's in Apr... Since March isn't available... I would assume that all the 7 customers in Apr are all new? Please let us know the logic behind these two things to help you better...

Best,

Sunny

Anonymous
Not applicable
Author

Hi,

Yes you are right.

I was just trying to show a sample, i should have mentioned 7 New for April and not 0. That's my fault.

And for Lost Customers, i mentioned 4 because these are the customers that are lost from April to May. From the perspective of Extract Date, I wasn't sure if the lost ones will show up in May or April. I figures since the records are on date of April, they may not show up in May and I mentioned in April.

I hope I am clear.

However, if you have a solution where I can show these 4 customers as lost customers in May, that will be great.

Thanks,

Roopali