Forum Discussion
Date Difference between 2 columns same table.
- 1 year ago
Add a custom column and use Duration.TotalDays, like:
Duration.TotalDays( [Final Ruling Date] - [Initial Ruling Date] )When doing addition with dates, you'll get a duration as an output. This function converts that duration to # days.
Output would look like the following. Note that if the initial or final date are null, then the custom column will also be null. I added nulls to your initial data to show this.
Duration.TotalDays is returning decimal number that includes fractional days.
Would there be a reason to use this function for two columns that only contain dates?
When only dealing with dates, then Duration.TotalDays and Duration.Days provide the same result. Perhaps there is a (probably infinitesimal) performance edge with using Duration.Days?
I went with Duration.TotalDays as it is more precise when dealing with datetimes, so it's more general purpose.
E.g.,
Duration.Days( #duration(0,23,59,59) ) = 0
VS
Duration.TotalDays( #duration(0,23,59,59) ) = 0.99998842592592585