Alteryx Designer Desktop Discussions

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

number of days between two dates

Ekta
8 - Asteroid

Dear All, 

Please help me with the formula for following condition-

 

how can i get the number of days between these two dates, only taking 2019 period like for

01/01/2019 and 31/12/2021- i need to calculate number of days between 01/01/2019 to 31/12/2019 and for 

01/08/2015 and 31/03/2019-i need to calculate number of days between 01/01/2019 to 31/03/2019 and for 

01/06/2019 and 31/05/2022 -i need to calculate number of days between 01/06/2019 to 31/12/2019 and for 

01/11/2019 and 31/10/22 -i need to calculate number of days between 01/11/2019 to 31/12/2019 and for 

 

 

01/01/201931/12/2021
01/08/201531/03/2019
01/06/201931/05/2022
01/11/201931/10/2022

 

Thank you so much in advance

9 REPLIES 9
Qiu
20 - Arcturus
20 - Arcturus

@Ekta 
Something like this?

1217-Ekta.PNG

RolandSchubert
16 - Nebula
16 - Nebula

Hi @Ekta ,

 

first step is to convert the dates to the Alteryx Date data type using a DateTimeParse function for both columns (called them "Start" and "End")
DateTimeParse([Start],'%d/%m/%Y')
DateTimeParse([End],'%d/%m/%Y')

The Data Type should be "Date" for both new columns, call them e.g. "StartDate" and "EndDate"

 

In a second step, you can dcalculate the difference using DateTimeDiff function:
DateTimeDiff([EndDate], [StartDate], 'days').

 

I've attached a sample workflow. Let me know if it works for you.

 

Best, 

 

Roland

 

Ekta
8 - Asteroid

Thanks a lot for the quick reply, but i am struggling with the year of the dates.i want to keep the period to only 2019 while using the datetime diff 😞

Thank you

Ekta
8 - Asteroid

Thanks a lot for the quick reply, but i am struggling with the year of the dates.i want to keep the period to only 2019 while using the datetime diff 😞

Thank you

RolandSchubert
16 - Nebula
16 - Nebula

Okay ... didn't read carefully. 

 

I think, an additional condition could solve the problem. Check, if "EndDate" is in 2019, else replace it by the last day of 2019.

 

I've modified the workflow a bit. What do you think?

 

Qiu
20 - Arcturus
20 - Arcturus

@Ekta 

Sorry. Made the same mistake with @RolandSchubert 

1217-Ekta-1.PNG

grazitti_sapna
17 - Castor

Hi @Ekta , give this a try as well.

 

grazitti_sapna_0-1608194148905.png

 

If it works then kindly mark this post as solution.

 

Thanks.

Sapna Gupta
bthursti
7 - Meteor

I am struggling get the days difference from 2 different dates to work, I am looking for the difference between Quarter Date - Creation Date, can someone take a look at this?

olivier_newman
8 - Asteroid

b

Labels