If you take an extract first, do you see the same issue?
Have you tried using the CONVERT function in the query itself to convert the number/string to date? The equivalent function in Oracle is TO_DATE.
I am having the same issue, except that my source data is in yyyy-mm-dd hh:mm:ss format. I convert it to a date using SQL: 'Convert(date,[field],21) as StartDate', but tableau doesn't read this field as a date. I then created a calculated field within tableau '=Date([StartDate])', and this worked well. When I try and use that calculated date as a filter, Tableau initially allows me to set it up. However, upon refreshing the data, I get this error:
- [Microsoft][ODBC SQL Server Driver][SQL Server]Explicit conversion from data type date to timestamp is not allowed.
- [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.
I was originally running off of live data, but I encountered the same issue even after taking an extract.
1 of 1 people found this helpful
You may first try to convert using Convert(date,[field],20) as StartDate (instead of 21 which contains milliseconds)
You can then, in the datasource tab of Tableau look for the field type detected and try to force it to Date&Time if it is not detected as is.
Thanks Dominique, that's solved it for me! I didn't know that about the Convert(date,[field],20). Once I made that change and forced Tableau to recognize the field as "Date", I didn't receive any errors. However, I did still see that error if I changed the field type to DateTime. Regardless, this works for me. Thanks for your help!