Duration Calculations

Neset_Kutlug
Participant II

Hi All,

The below expression aims to calculate the duration between the shift start time and shift end time in duration. It aims to handle cases where shift start is before midnight and shift end is after midnight. Both fields are in Time column type. And the column I am building this expression into is Duration column type, that is Shift Duration.

But it returns this error; Arithmetic expression โ€˜([Shift Start]+[Shift End])โ€™ has inputs of an invalid type โ€˜Unknownโ€™.

IF(
[Shift End]<[Shift Start],
("00:00:00 - "[Shift Start]) + [Shift End],
[Shift End]-[Shift Start]
)

Your expertise in helping me is appreciated.

Cheers,

NeลŸet

0 2 204
2 REPLIES 2

I believe adding time to time will give an error.

You may wish to take a look at how time math works in the associated post below. Also please take a look at the help article enclosed in that post and Time and Duration calculations.

The shift crosses over from one date to the next date in the example shared by you. This could possibly make using time type columns valid for calculating duration. However, generally, the DatetIme type column is more useful in such cases to calculate duration where days change.

Thank you very much Suvrutt. I will look into it.

Top Labels in this Space