Forum Discussion
TenguMan
2 years agoFrequent Visitor
How to limit duration to a given time range
Hello, I have a report that deals with customer service case data and how long a given case takes. I have been asked to calculate the duration of these cases such that it only counts the time tha...
halfglassdarkly
Responsive Resident
2 years agoHow are you accounting for cases that span multiple days (assuming that is possible)?
If you have a date/time value you can use the DATEDIFF function to calculate hours between date times. E.g.
DATEDIFF([Start Date/Time],[End Date/Time],HOUR)
If you have Date and Time as seperate columns you can add them together like so:
DATEDIFF([Start Date]+[Start Time],[End Date]+[End Time],HOUR)
If you only care about comparing time and not date (if case open/close are always the same date) you could use an arbitrary date e.g.
DATEDIFF(DATE(2024,01,01)+[Start Time],DATE(2024,01,01)+[End Time],HOUR)
UPDATE: apologies, I completely missed the part where you said you needed to calculate work hours. Greg's solution looks more promising for that.