0
votes

I connected Tableau to an SQL Server Database to produce some visualisations. I have several date fields on my tables which are in this format : "DD/MM/YYY HH:MM:SS" Tableau reads all those fields as String, and when I try to convert the field format to datetime I get multiple Null fields. This is because Tableau reads the date in the following format : "MM/DD/YYYY HH:MM:SS".

So for exemple if the date as a string is initially : "02/04/2019 00:00:00" (2 April 2019), after converting to datetime format in Tableau I will get : "04/02/2019 00:00:00" And if the initial date as a string is "15/03/2019 00:00:00" (15 march 2019), after converting to datetime in Tableau I will get Null value (because for Tableau 15 isn't recognized as a month).

So my question is : How can I change Tableau's parameters to read my date values as DD/MM/YYYY HH:MM:SS?

I have already tried to change the default date properties for my table on Tableau by clicking on Date Properties and changing the date format to Custom, but nothing has changed.

Also, I don't want to change my date format by creating calculated fields because I have multiple date fields and it would be so time consuming to do that for every single field.

1

1 Answers

0
votes

You should probably store date-time values in the database using [datetime] columns to avoid such issues. Given the situation, though, use Tableau's DATEPARSE function, e.g.:

DATEPARSE("dd/MM/yyyy HH:mm:ss", [DateStringColumnName])

REF: Create a calculation using the DATEPARSE function