Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
What would be the right expression to count interval of days from purchase date with the previous purchase date?
Sales_Id | Customer | Purchase Date | Purchase Interval |
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 |
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?
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
];
Or this? Front end