DateDiff() function help - Dates in 2 different columns

cg529d picture cg529d · May 20, 2015 · Viewed 33.9k times · Source

I am trying to write a function to enable Tableau to calculate the difference between 2 dates, however they are in 2 different columns and I am having a bit of trouble.

Example:

Column 1

First Opened Date - 10/01/2014

Column 2

Reviewed Date - 15/01/2014

Obviously from this example there is 5 days between the two different columns.

These columns are aligned in rows due to a unique ID.

Any help would be much appreciated!

Thanks Ellie

Answer

e h picture e h · May 20, 2015

I am not sure exactly what your data looks like, but you could calculate the difference in days between two dates by using the datediff function.

I am using this calculation: DATEDIFF('day',[Order Date],[Ship Date])

You can easily recreate this with the sample data set (superstore) that ships with tableau.

enter image description here