Duration Calculations

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

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.

1 Like

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

2 Likes