Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
renjithpl
Specialist
Specialist

Lost, New and Loyal Customers month wise

Hi All,

I am trying to find Lost, New and Loyal customers month wise.

User will select year and a month, a pivot table should show the count of the customers lost in current month, new customers in current month and loyal customers.

Also when user search for a customer, it should fall on these three categories.

I have searched in the community, but could not find the correct solution.

regards

1 Solution

Accepted Solutions
renjithpl
Specialist
Specialist
Author

Whiteline -

Lost Customers - who made sales previous month but not current month

New Customers - who made sales current month but not previous month

Loyal Customers - who made sales previous month and current month

I tried something like below - It works,

for loyal - count({<Year=, Month=, FY=, CustomerCode= P({<BilledYearMonth={"$(=monthname(max(BilledYearMonth)-1))"}>}), BilledYearMonth={"$(=monthname(max(BilledYearMonth)))"} >} distinct CustomerCode)

for New - count({<Year=, Month=, FY=, CustomerCode= E({<BilledYearMonth={"$(=monthname(max(BilledYearMonth)-1))"}>}), BilledYearMonth={"$(=monthname(max(BilledYearMonth)))"} >}distinct CustomerCode)

for Lost -

count({<Year=, Month=, FY=,  CustomerCode= E({<BilledYearMonth={"$(=monthname(max(BilledYearMonth)))"}>}),

  BilledYearMonth={"$(=monthname(max(BilledYearMonth)-1))"} >} DISTINCT CustomerCode)

Cheers !!


View solution in original post

4 Replies
whiteline
Master II
Master II

What is "Lost, New and Loyal", Attributes, Fields, Group ?

To answer your question the way the info is stored is important.

renjithpl
Specialist
Specialist
Author

Whiteline -

Lost Customers - who made sales previous month but not current month

New Customers - who made sales current month but not previous month

Loyal Customers - who made sales previous month and current month

I tried something like below - It works,

for loyal - count({<Year=, Month=, FY=, CustomerCode= P({<BilledYearMonth={"$(=monthname(max(BilledYearMonth)-1))"}>}), BilledYearMonth={"$(=monthname(max(BilledYearMonth)))"} >} distinct CustomerCode)

for New - count({<Year=, Month=, FY=, CustomerCode= E({<BilledYearMonth={"$(=monthname(max(BilledYearMonth)-1))"}>}), BilledYearMonth={"$(=monthname(max(BilledYearMonth)))"} >}distinct CustomerCode)

for Lost -

count({<Year=, Month=, FY=,  CustomerCode= E({<BilledYearMonth={"$(=monthname(max(BilledYearMonth)))"}>}),

  BilledYearMonth={"$(=monthname(max(BilledYearMonth)-1))"} >} DISTINCT CustomerCode)

Cheers !!


Not applicable

thanx.

It realy helpfull.

Not applicable

Hi Renjith

I adapted your solution for my own analysis and it really works!

However, I do not quite understand the code. Could you explain what does it do?

Thanks!

Dingyong