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

Sales of new/loyal/lost customers

Hi all,

I am trying to get the sum of sales of customers in a chart with:

- sales this year & no sales last year (=NEW customers)

- sales last year & no sales this year (=LOST customers)

- sales this year & sales last year (=LOYAL customers)

My time dimensions are Month, MonthYear and Year

All help is welcome!

4 Replies
olivierrobin
Specialist III
Specialist III

hello

try with set analysis like :

if(sum({<Year={'$(=Max(Year)'}>}sales) +sum({<Year={'$(=Max(Year)-1'}>}sales) ,'LOYAL'),

if(sum({<Year={'$(=Max(Year)'}>}sales)>0 and sum({<Year={'$(=Max(Year)-1'}>}sales)=0,'LOST',

  if(sum({<Year={'$(=Max(Year)'}>}sales)=0 and sum({<Year={'$(=Max(Year)-1'}>}sales)>0,'NEW'

  )

)

)

sasiparupudi1
Master III
Master III

May be something like below(Ex Loyal)

Count(

IF(Sum({Year={"$(=Max(Year))"}}Sales)>0 AND Sum({Year={"$(=Max(Year)-1)"}}Sales)>0, Customers)

)

effinty2112
Master
Master

Hi Jorgen,

There are bound to be syntax errors here but these suggestions might help

NEW
Sum({$<Year = {$(=max(Year))}, Customer = E({<Year={$(=-1+max(Year))}>} Customer)>}Sales)

LOST
Sum({$<Year = {$(=-1+max(Year))}, Customer = E({<Year={$(=max(Year))}>} Customer)>}Sales)

LOYAL
Sum({$<Year = {">= $(=-1+max(Year))"}, Customer -= E({<Year={">=$(=-1+max(Year))"}>} Customer)>}Sales)

Cheers

Andrew