1 Reply Latest reply on Nov 10, 2011 12:04 AM by Richard Leeke

    Calculate the elapsed time between 2 Date/Time values

    Jamie Moyle

      Can anyone offer some advice as to how I calculate the elapse time period between 2 date/time values.


      Start Date: 20110823 21:09:51>>>>Finish Date: 20110914 19:21:00

        • 1. Re: Calculate the elapsed time between 2 Date/Time values
          Richard Leeke

          Are your fields recognised by Tableau as the datetime data type, or are they strings?


          If Tableau knows they are datetimes you can use the DATEDIFF() function to find the difference in units of 'day', 'hour', 'minute' or 'second', or you can just subtract the start from the finish and that will give you a floating point number representing the (fractional) number of days between the two (i.e. if the answer is 1.25 that means 1 day and 6 hours).


          If your fields are strings you'll need to convert them to datetimes first.  You'll need to reformat slightly to get those strings into a format the DATETIME() function recognises (easiest is just to insert a couple of "/" characters.