Using 'datetimeoffset' from SQL Server in Tableau

A form of SQL Server is a very common way of retrieving your data to use in Tableau. In SQL it is normal to store dates (with specific times) in the 'datetimeoffset' datatype however, Tableau does not support this.

What should you do?

Once you have loaded in your data from SQL Server you will notice that the field that has the 'datetimeoffset' datatype will not show however, do not panic. Everything is fixable! (usually)

Step 1 - Go to the data pane

Go to the datapane, click the downwards arrow, and click 'Convert to Custom SQL'.

Step 2 - View the Custom SQL pane

Once you have converted your table to custom SQL, you will see a pop-up like this.

As we said before, the table is missing one field from our original table in SQL Server.

Step 3 - Cast the missing field as DateTime

Find the name of your original field in SQL Server and type as follows.

CAST([TableName].[Field] as DateTime) as [Field]

Step 4 - Close the Custom SQL pane and use the field in Tableau!

Thank you for reading, I hope this helped!

Author:
George Ledger
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab