community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Intervals between dates in different rows

Atom

Hi all,

 

I have a database with all the transactions of a set of customers. One important parameter for us is to understand each client's interval between two consecutive visits. In out database, each row is one visit as in the example below:

 

Client Visit
1 5-Jan
1 10-Jan
1 20-Jan
2 10-Jan
2 30-Jan

 - For client 1, the interval between his 1st and 2nd visits were 5 days and between his 2nd and 3rd visits 10 days.

- For client 2, with only two visits, the interval was 20 days

 

Given that the number of visits can go up to hundreds, does anybody know how could I have another column calculating the number of days since the last visit?

 

Thank you in advance!

 

Best,

Vinicius

@shangaz

 

take a look at the attached workflow which may give you an idea how you can proceed

hope this is what your are looking for

this could be the correct one

 Interval.PNG

Sr. Learning Strategy Manager
Sr. Learning Strategy Manager

Shangaz,

Assuming your DB also carries date with a year, I would first convert your date to be a date data type in alteryx, then use the multi-row formula and leverage the datediff() function. 

2016-02-23 23_07_41-Alteryx Designer x64 - VisitIntervals.yxmd_.png

Atom

@JoeM and @s_pichaipillai,

 

Thank you very much for your answers!

Coincidentally, my Alteryx stopped working today, but as soon as it comes back, I'm going to test your solutions and give you a feedback!

 

Best,

Asteroid

How did you get the first date for Client 2 to not be the Interval from Client 1's last date?  I can't see it in the workflow but the screen shot shows it has been done.

Highlighted
Asteroid

I got it.  It's group by function. 

Labels