Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys,
I have a table with all the sales history and I want to calculate the days od frequency from one order to another , see the picture below
SalesID | Customer | Date | Days of Frequency | |
| C0001 | 01/01/2015 | ||
PV002 | C0002 | 10/01/2015 | ||
PV003 | C0003 | 20/01/2015 | ||
PV004 | C0004 | 31/01/2015 | ||
PV005 | C0001 | 10/02/2015 | 40 | |
PV006 | C0002 | 15/02/2015 | 36 | |
PV007 | C0003 | 20/02/2015 | 31 | |
PV008 | C0004 | 28/02/2015 | 28 | |
PV009 | C0001 | 15/03/2015 | 33 | |
PV010 | C0002 | 25/03/2015 | 38 | |
PV011 | C0003 | 28/03/2015 | 36 | |
PV012 | C0004 | 31/03/2015 | 31 |
Any suggestion?
Many many thank's
Eduard
Something like this:
Temp:
LOAD
SalesID,
Customer,
Date
FROM ...
Result:
LOAD
SalesID,
Customer,
Date,
If(Customer=Previous(Customer), Date-Previous(Date)) as "Days of Frequency"
Resident Temp
Order By Customer, Date;
Drop Table Temp;
Something like this:
Temp:
LOAD
SalesID,
Customer,
Date
FROM ...
Result:
LOAD
SalesID,
Customer,
Date,
If(Customer=Previous(Customer), Date-Previous(Date)) as "Days of Frequency"
Resident Temp
Order By Customer, Date;
Drop Table Temp;
wowwwwwwwwwwwwwwww
Many many thank's Gysbert