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

Trend of place visited by same customers

Hi All

i have a very long list of dataset and below is a subset of it. Appreciate if you could advise the scripts over here as i am using personal edition.

Based on the question table, i would like to know the repeat customers trend in their place visited. for example, for the same customer A, based on their earliest date of visit, they went to Europe and subsequently went to  China. with that i would like to have a table indicated below to sum up these trend of events by duplicate customer.

Please assist .

   

Question
Customer Place visitedDate of visit
AEurope10/4/2015
BChina14/9/2015
C Singapore18/11/2015
AChina20/9/2015
BEurope13/1/2015
C Singapore12/1/2016
DMalaysia13/2/2016

  

AnswerVisited place after their first visited place
Repeated Customer visited place based on earliest dateEuropeChinaSingaporeTotal
Europe 1 1
China1 1
Singapore 11
1 Solution

Accepted Solutions
alexpanjhc
Specialist
Specialist

A:

LOAD * INLINE [

Customer, Place visited, Date of visit

A, Europe, 10/4/2015

B, China, 14/9/2015

C, Singapore, 18/11/2015

A, China, 20/9/2015

B, Europe, 13/1/2015

C, Singapore, 12/1/2016

D, Malaysia, 13/2/2016

]

;

temp1:

load *,

if (Customer=Previous(Customer),1,0) as customer_visit_seq,

if (Customer=Previous(Customer),Previous([Place visited]),'') as Last_Places

Resident A

order by Customer,[Date of visit];

drop table A;

in the chart, you can use the last_places and place visited as dimension and then sum(customer_visit_seq) as expression.

HTH

View solution in original post

3 Replies
alexpanjhc
Specialist
Specialist

I think the answer should be below ?

Repeated Customer visited place based on earliest dateEuropeChinaSingaporeTotal
Europe22
Singapore11

see the attached file.

Not applicable
Author

yes you are right. As i am using personal edition, can you paste your scripts here?

alexpanjhc
Specialist
Specialist

A:

LOAD * INLINE [

Customer, Place visited, Date of visit

A, Europe, 10/4/2015

B, China, 14/9/2015

C, Singapore, 18/11/2015

A, China, 20/9/2015

B, Europe, 13/1/2015

C, Singapore, 12/1/2016

D, Malaysia, 13/2/2016

]

;

temp1:

load *,

if (Customer=Previous(Customer),1,0) as customer_visit_seq,

if (Customer=Previous(Customer),Previous([Place visited]),'') as Last_Places

Resident A

order by Customer,[Date of visit];

drop table A;

in the chart, you can use the last_places and place visited as dimension and then sum(customer_visit_seq) as expression.

HTH