Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
priyarane
Specialist
Specialist

Second Purchase Product

Hi Community,

 

How to find second purchase product to find for the below scenario. So here

my out put should be like this

CustomerProduct
ACap
BFant
ECalc
EXXXXX

 

 

Data:

CustomerProductDate
APen1/1/2019
ACap2/1/2019
BShirt2/1/2019
BTrouser2/1/2019
BFant3/1/2019
Cxxx2/1/2019
DYyy3/1/2019
ECom2/1/2019
ECalc3/1/2019
EPillo2/1/2019
EXXXXX3/1/2019

 

Please help us to find the solution.

 

_Priya

3 Solutions

Accepted Solutions
sunny_talwar

Try this

Dimension

Customer
Product

Expression

Aggr(If(Date = Max(TOTAL <Customer> Date) and Count(TOTAL <Customer> DISTINCT Product&Date) > 1, 1), Customer, Product, Date)

View solution in original post

priyarane
Specialist
Specialist
Author

Thanks Sunny, I got it with a small change of your expr

Aggr(If(Date = Min(TOTAL <Customer> Date,2) and Count(TOTAL <Customer> DISTINCT Product&Date) > 1, 1), Customer, Product, Date)

View solution in original post

MarcoWedel

Hi,

maybe this part of your expression already suffices:

Date = Min(TOTAL <Customer> Date,2)

(keeping the same dimensions)

 

hope this helps

regards

Marco

View solution in original post

4 Replies
sunny_talwar

Try this

Dimension

Customer
Product

Expression

Aggr(If(Date = Max(TOTAL <Customer> Date) and Count(TOTAL <Customer> DISTINCT Product&Date) > 1, 1), Customer, Product, Date)
priyarane
Specialist
Specialist
Author

Thanks Sunny,

 

It works if we have 2 dates only for ex below data we have 3 dates.

Here we should get Product_2 as it purchased on second date but as per your expr we are getting Product_3.

 

Cust_AProduct_19/1/2019
Cust_AProduct_210/1/2019
Cust_AProduct_311/1/2019
priyarane
Specialist
Specialist
Author

Thanks Sunny, I got it with a small change of your expr

Aggr(If(Date = Min(TOTAL <Customer> Date,2) and Count(TOTAL <Customer> DISTINCT Product&Date) > 1, 1), Customer, Product, Date)
MarcoWedel

Hi,

maybe this part of your expression already suffices:

Date = Min(TOTAL <Customer> Date,2)

(keeping the same dimensions)

 

hope this helps

regards

Marco