Forum Discussion

Christophe Humbert's avatar
Christophe Humbert
Iron Contributor
Nov 30, 2018
Solved

Calculate a duration in column formatting

How can I calculate a duration in column formatting?

 

With calculated columns, I can calculate a duration in days by subtracting two dates. For example if Start is 9/2/2018 and End is 1/31/2019, End-Start returns 151.

 

With column formatting, End-Start returns 5/31/1970.

 

I understand that I could use both the calculated column and column formatting, but I'd rather do it in one shot. My formatting involves multiple calculations.

  • I found a solution with the help of another thread.

     

    The Number() operator converts a date into millisaconds. So the formula I came up with in column formatting is:

    "=(Number([$End])-Number([$Start]))/1000/60/60/24"

1 Reply

  • I found a solution with the help of another thread.

     

    The Number() operator converts a date into millisaconds. So the formula I came up with in column formatting is:

    "=(Number([$End])-Number([$Start]))/1000/60/60/24"

Resources