 # Duration in hours - not days

#1

If the Duration format options don’t work for you you can you can build your own formula. If you subtract two date values together you’ll get the difference in days as a floating point number. If you multiply that by 24 you’ll get the result in hours. You can truncate or round the result into a whole number as you prefer.

Try something like: Round((Date1-Date2) * 24, 0) + ’ hrs’

6 Likes
#2

A related question… I have a formula that tries to sum duration values for the current year:

``````[Work Log].Filter(Year=year(Today())).[Session Duration].Sum()
``````

In other words, I’m filtering the “Work Log” Table by the column “Year” when it equals the current year, and then summing up the durations for each record.

The result looks like this:

``````22 days 2 hrs 11 mins
``````

Is there an easy fix to the formula to produce the value in hours? I tried applying the HOURS formula but the result was not what I expected. Here’s what I would like to see:

``````530 hours 11 mins
``````

or

``````530 hours
``````

Appreciate any advice you can offer…

#3

What @mallika said should still work with a little adjustment. Use AbsoluteValue() and then multiply by 24.

``````[Work Log].Filter(Year=year(Today())).[Session Duration].Sum().AbsoluteValue()*24
``````

I haven’t tried you’re use case with the Filter, but I have this running for adding up hours worked for the week and rounding it to two decimal points. You could wrap that same line in Round( , ) if you wanted a decimal instead of minutes.

4 Likes
#4

That did the trick! Thanks so much!

1 Like
#5

Is there any way we could have this translate to a Gannt chart?