Alteryx Designer Desktop Discussions

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

Difference between Dates

Anudeep_Yalamuru
8 - Asteroid

Hi All,

 

I have a dataset (sample at the bottom) containing different dates for each ID. I want to calculate difference between each date in Date column for a ID.

 

Ex - For ID "A", I want to calculate difference between date 1 and date 2 and date 2 and date 3. 

 

I know how to do it in Excel, but the dataset is huge. Please provide your valuable inputs. 

 

Thanks,

Anudeep

 

IDDate
A13/04/2021
A28/04/2021
A04/12/2021
B26/04/2020
B27/10/2020
B17/11/2020
B22/03/2021
B01/07/2021
B09/10/2021
B09/03/2022
B31/08/2022
4 REPLIES 4
Raj
16 - Nebula

Use multirow formula

FinnCharlton
13 - Pulsar

Hi @Anudeep_Yalamuru , this should do the trick

FinnCharlton_0-1686913748011.png

 

ed_hayter
12 - Quasar

ed_hayter_0-1686913837632.png

Multi-row formula grouped by your ID should work.

 

I use datetime diff taking the prior row date away from the current row date and returning the number of days.

ed_hayter_1-1686913891602.png

This ensures a reset each ID

ed_hayter_2-1686913902570.png

 

Hence the first row of each record is null.

 

Note. Make sure your dates are the date data format to compute a datetimediff

Raj
16 - Nebula

PFA

Labels
Top Solution Authors