Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

How to calculate the time difference between two time in hh:mm:ss format?

Emmm
7 - Meteor

Dear helpers, 

I'm trying to calculate the time difference between two time in hh:mm:ss format.

Please see the attached excel file for example - Interval column is the result that I need. 

 

Thank you so much!!!

7 REPLIES 7
Qiu
21 - Polaris
21 - Polaris

@Emmm 
I first add the Date of today to make Date Time format then perform some DateTimeDiff and formula tool to get the format you want.

0703-Emmm.png

Emmm
7 - Meteor

Thank you @Qiu !

I tried a similar workflow (please see attached) but i'm not sure why some calculations did not work out as the intervals came out blank? 

The result is in "trial" excel. 

Qiu
21 - Polaris
21 - Polaris

@Emmm 
It is simply because there are some null values in the column " fvoidtime", so we can not calculate the difference.
You can defind a logic for this case with a filter tool.

0703-Emmm-A.png

Emmm
7 - Meteor

Sorry @Qiu  I think the input I shared was wrong. This input file did not have any null values - but still getting blank intervals... 

Qiu
21 - Polaris
21 - Polaris

@Emmm 
We can see that in some of the records, the Void Time is smaller than the Check Open time, meaning the Void Time passed the midnight.
So we should seperate these two cases.

0703-Emmm-C.png

Emmm
7 - Meteor

Thank you so much @Qiu ! I did not realize there are overnight cases causing this issue before... because one of the cases that I were not able to get the result was the second row. Thank you again!!!!   

 

Weixin Image_20240704094828.png

 

Qiu
21 - Polaris
21 - Polaris

@Emmm 
Glad to be helpful. 😁

Labels