Calculate difference between 2 dates in days

I have dates in 2 columns, I want to calculate the difference the two in days…how do I achieve this.

Solved Solved
0 9 8,335
1 ACCEPTED SOLUTION

There is a TOTALHOURS() function I believe you could use.

TOTALHOURS([Date2] - [Date1]) / 24

A feature request has been made for a TOTALDAYS() function but it is not yet available as far as I know.

View solution in original post

9 REPLIES 9

There is a TOTALHOURS() function I believe you could use.

TOTALHOURS([Date2] - [Date1]) / 24

A feature request has been made for a TOTALDAYS() function but it is not yet available as far as I know.

Hi, could u please also tell me what is column type I should have while I use this expression provided

Try duration type.

with type set to duration it showed as error…when i changed it to Number Type…it worked

Decimal is the best type. The resulting value is in hours but could have partial hours such as 124.8.

Using Number is okay if you are good with rounded values to the nearest whole day. I believe 124.8 would be rounded up to 125 while 124.3 would be rounded down to 124. At least I believe that is what I have observed when a decimal value is stored into a Number type column. If the rounding is of concern, you can easily test what happens.

hey do you know how to that but instead of days is weeks

Changing "24" to "168" or adding "/7" at the end, after wraping the previous with "()"

Instead, I would prefer to do something like

WEEKNUM([Date 1])-WEEKNUM([Date 2])


@admin_YyH wrote:

Instead, I would prefer to do something like

WEEKNUM([Date 1])-WEEKNUM([Date 2])


 

That is a good option as long as the both the dates are in the same calendar year.  If the two dates are in different calendar years , the expression may not work as the WEEKNUM() resets to 1 in every new year's first week.

Top Labels in this Space