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

Interval

Hi,

What would be the right expression to count interval of days from purchase date with the previous purchase date?

  

Sales_IdCustomerPurchase DatePurchase Interval
1Mr Smith26-Jul-17
2Mr Smith06-Jul-17
3Mr Smith26-Jun-17
4Mr Smith08-May-17
5Mr Smith04-Apr-17
6Mr Smith29-Mar-17
7Mr Smith28-Feb-17

Basically I want to know the interval between purchase dates.

So what expression should I use to populate the above highlighted column to know total number days between two purchases?

2 Replies
Anil_Babu_Samineni

May be this?

LOAD *, Interval(Previous([Purchase Date])-[Purchase Date],'dd') as [Purchase Interval];

LOAD Sales_Id, Customer, Date(Date#([Purchase Date],'DD-MMM-YY')) as [Purchase Date] Inline [

Sales_Id, Customer, Purchase Date

1, Mr Smith, 26-Jul-17

2, Mr Smith, 06-Jul-17

3, Mr Smith, 26-Jun-17

4, Mr Smith, 08-May-17

5, Mr Smith, 04-Apr-17

6, Mr Smith, 29-Mar-17

7, Mr Smith, 28-Feb-17

];

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

Or this? Front end

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful