Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

How to calculate days of frequency

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

  

SalesIDCustomerDateDays of Frequency
 
PV001
C000101/01/2015
PV002C000210/01/2015
PV003C000320/01/2015
PV004C000431/01/2015
PV005C000110/02/201540
PV006C000215/02/201536
PV007C000320/02/201531
PV008C000428/02/201528
PV009C000115/03/201533
PV010C000225/03/201538
PV011C000328/03/201536
PV012C000431/03/201531

Any suggestion?

Many many thank's

Eduard

1 Solution

Accepted Solutions
Gysbert_Wassenaar

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;


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

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;


talk is cheap, supply exceeds demand
ecabanas
Creator II
Creator II
Author

wowwwwwwwwwwwwwwww

Many many thank's Gysbert