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

Sum of New Customer Sales

Hello, 

I am trying to create a measure that Sums sales of new customers. 

A new customer is defined as a customer that had no sales in 2019, but now has sales in the quarter I am filtered on in 2021 (Q3 currently).

Currently I have a measure to Sum total 2019 Sales as below:    (M1)

SUM({<PPE={'No'},[Label Brand]={'Own Brand'},Type={'Telesales'},Year={'2019'},Quarter=>}Sales)

And a measure to SUM Sales in the selected quarter of 2021 as below:    (M2)

SUM({<PPE={'No'},[Label Brand]={'Own Brand'},Type={'Telesales'},Year={'2021'}>}Sales)

As you can see, I already have a few conditions for Sales to be included. 

 

So what I need is for a measure that effectively shows me the sum of M2 for each customer where M1 = 0. My Customer field is [Site_ID]....not sure if that needs to be built into the original measures? 

I am relatively new to Qlik Sense, from an accounting background rather than BI, so know little of loading script, so if that is what is required, please be gentle and explain as if you are talking to a child!

 

Any help much appreciated.

Thanks

 

1 Reply
jlg
Contributor II
Contributor II
Author

Ok, so I have come up with a soution to my problem using AGGR, but now seem to be having the most basic of issues.

Using the following measure I have created the opposite of what I was looking for:

sum(If(AGGR(SUM({<PPE={'No'},[Label Brand]={'Own Brand'},Type={'Telesales'},Year={'2019'},Quarter=>}Quantity),[Site ID])>0,Aggr(SUM({<PPE={'No'},[Label Brand]={'Own Brand'},Type={'Telesales'},Year={'2021'}>}Sales),[Site ID]),0))

So this gives me old customers. And in my head, all I need to do to change to new customers is change the >0 to =0. However, this just returns 0. What am I missing?