Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
davidg_curs
Contributor II
Contributor II

Calculate returning customers

Hi,

Please help.....

I want to calculate how many products bought return customers from last year in this year, regardless SALES_AGENT.

Should be 7 products... I can't figure out how to use SET analysis 😞

  

CUSTOMER_IDPRODUCTQUARTERYEARSALES_AGENT
1FRUITQ22015JOHN
2BEERQ22015JOHN
3BREADQ22015JOHN
4EGGSQ22015JOHN
5PAPERQ22015JOHN
1BEERQ22015JOHN
1EGGSQ22015JOHN
2EGGSQ22015JOHN
4FRUITQ22015JOHN
1FRUITQ22016JOHN
1BEERQ22016JOHN
1EGGSQ22016JOHN
2BEERQ22016GEORGE
4EGGSQ22016WILLY
4FRUITQ22016WILLY
4BREADQ22016WILLY

6

BREADQ22016MARTHA
6EGGSQ22016

MARTHA

7BEERQ22016JANE
7PAPERQ22016JANE

Thanks!

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

Maybe this?

count({<CUSTOMER_ID=P({1<YEAR={2015}>})>} PRODUCT)

View solution in original post

2 Replies
johnw
Champion III
Champion III

Maybe this?

count({<CUSTOMER_ID=P({1<YEAR={2015}>})>} PRODUCT)

davidg_curs
Contributor II
Contributor II
Author

Hi John,

thanks for the answer. It gives me the correct result.

I also try:

=Count({<YEAR = {'2016'},

                CUSTOMER_ID={"=COUNT({<YEAR = {'2015'}>}PRODUCT)>0"}

              >} PRODUCT)

which is also one of the solutions.