# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for
Did you mean:
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
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'

)

)

)

MVP
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)

)

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