Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
GreatGreekYogurt
Contributor III
Contributor III

Calculate days between purchases

Good Day to Everyone!

I want to calculate days between each purchase made by distinct customer.
I have 3 fields, Order ID, Customer ID, Order Date.

Order ID is unique field here

Example:

 

 

LOAD * INLINE [
Order ID|Customer ID|Order Date
1|1|18/04/2020
2|2|20/05/2020
3|2|23/05/2020
4|3|25/04/2020
5|3|27/05/2020
6|3|29/05/2020
7|4|01/06/2020
8|4|04/06/2020
](delimiter is |);

 

 

 

So what makes it difficult for me, some customers have made only 1 purchase, some have made 3 and some have made 2. I need to calculate days between purchases. Please advise how I can do that?

 

Labels (4)
1 Solution

Accepted Solutions
AbhijitBansode
Specialist
Specialist

Try script as attached.

I've derived date diff by customer and overall date diff.

View solution in original post

1 Reply
AbhijitBansode
Specialist
Specialist

Try script as attached.

I've derived date diff by customer and overall date diff.