Date diff with milliseconds with Tableau Software

In Tableau Desktop, I've got two date dimensions representing the begin date and the end date of an event. To know the duration of an event, I do DATEDIFF('second', [begin date], [end date]).

Unfortunately, some events last less than one second so there are many zero length durations.

How can I get more precision (milliseconds would be fine)?

My data source is an Excel file.

Upvotes: 4

Views: 5782

Answers (1)

Alexander
Alexander

Reputation: 1967

Try the following:

  1. define the column as a float
  2. subtract the float dates as you need to in a calculated field
  3. now you have the difference as a decimal in days, if you want to get it down to milliseconds, you do [floatdate] * 24 * 60 * 60

If you need the column in a proper date format as well, you can just copy it with a calcualted field in another column and define that as a date.

Upvotes: 5

Related Questions