We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

calculation of Date time differences, output as day and hours

pgayath1
8 - Asteroid

 

calculation: taredatetimein  should be subtracted from grossdatetimeout and the difference shall be displayed as days and hours

(grossdatetimeout -  taredatetimein )

taredatetimein grossdatetimeout
3/7/2019 7:09 3/7/2019 13:45
3/8/2019 7:21 3/8/2019 19:05
3/9/2019 12:16 3/11/2019 13:53
3/11/2019 21:57 3/12/2019 15:19
3/13/2019 18:50 3/14/2019 19:24
3/15/2019 11:26 3/15/2019 20:18
3/16/2019 16:21 3/18/2019 8:15
3/18/2019 17:29 3/19/2019 10:48
3/19/2019 19:40 3/20/2019 20:27

 

Is this achievable with (Datetimediff) function in Alteryx using formula tool?

 

Is there a better way to achieve that?

 

1 REPLY 1
neilgallen
12 - Quasar

this is easily achievable in alteryx, with a few requirements:

 

1) alteryx handles dates in the standard format of YYYY-MM-DD so you will need to convert your strings into standard date time formats. This could be done with

 

datetimeparse([field],"%m/%d/%Y %H:%M")

 

and then calculating the different between the two with a datetimediff formula:

 

datetimediff([grossdatetimeout],[taredatetimein],'units')

 

where 'units' is your desired unit of return. That said, if you choose days it returns whole days as integers, so you are better off choosing hours and then modifying the unit to your desired result.

 

All of the above could be done in one formula tool!

Labels
Top Solution Authors