Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Carlaf_93
Creator II
Creator II

Calculate lost customer

Good morning,

i applyed this formula to calculate the number of lost customers:

count({$<PeriodCounter=,CLIENT_NAME={'=sum({1<PeriodCounter={"$(=max(PeriodCounter)-1)"}>} [Bill Amount])>0 and (sum({1<PeriodCounter={"$(=max(PeriodCounter))"}>} [Bill Amount])=0 )'}>}distinct CLIENT_NAME)

and it works.

I would like to define the lost ones like this now (if  there is a decline of 50% i define it like lost):

count({$<CLIENT_NAME={'=(sum({1<PeriodCounter={"$(=max(PeriodCounter))"}>} [Bill Amount])/sum({1<PeriodCounter={"$(=max(PeriodCounter)-1)"}>} [Bill Amount]))>0.5 )'}>}distinct CLIENT_NAME)

but it doesn't work.

Ideas?

Thanks.

1 Solution

Accepted Solutions
agigliotti
Partner - Champion
Partner - Champion

Hi @Carlaf_93 ,

Maybe this:
count( {< CLIENT_NAME = {"=(sum( {1< PeriodCounter = {$(=max(PeriodCounter))} >} [Bill Amount] ) / sum( {1< PeriodCounter = {$(=max(PeriodCounter-1))} >} [Bill Amount] ) )>0.5"}>} distinct CLIENT_NAME )

the same @Anil_Babu_Samineni 's expression but without a close bracket.

I hope it can help.
Best Regards

View solution in original post

4 Replies
Anil_Babu_Samineni

Try this? and also make sure how the values are returning for inner set analysis so that you will get an idea to change 0.5 to required since there is comparion going on..

count({$<CLIENT_NAME={"=(sum({1<PeriodCounter={$(=max(PeriodCounter))}>} [Bill Amount])/sum({1<PeriodCounter={$(=max(PeriodCounter-1))}>} [Bill Amount]))>0.5 )"}>} distinct CLIENT_NAME)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Carlaf_93
Creator II
Creator II
Author

Thanks for your reply. 

But this doesn't work. I tryed to see the output of this: sum({1<DATA.autoCalendar.Year={"2021"}>} NETTO)/sum({1<DATA.autoCalendar.Year={"2020"}>} NETTO))>0.5 and is 0.9 so the format seems right.

Any ideas?

agigliotti
Partner - Champion
Partner - Champion

Hi @Carlaf_93 ,

Maybe this:
count( {< CLIENT_NAME = {"=(sum( {1< PeriodCounter = {$(=max(PeriodCounter))} >} [Bill Amount] ) / sum( {1< PeriodCounter = {$(=max(PeriodCounter-1))} >} [Bill Amount] ) )>0.5"}>} distinct CLIENT_NAME )

the same @Anil_Babu_Samineni 's expression but without a close bracket.

I hope it can help.
Best Regards

Anil_Babu_Samineni

For me this is ok, do you see any issue? can you please share some sample dataset?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful