Explore Courses Blog Tutorials Interview Questions
0 votes
in BI by (17.6k points)

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.


Column 1

First Opened Date - 10/01/2014

Column 2

Reviewed Date - 15/01/2014

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

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

Any help would be much appreciated!


1 Answer

+1 vote
by (47.2k points)
selected by
Best answer
  • By using the datediff function, you could calculate the difference in days between two dates, 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.


  • Please use attr(DATEDIFF('day',[Order Date],[Ship Date]))

Related questions

0 votes
1 answer
asked Feb 4, 2020 in BI by Vaibhav Ameta (17.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories