Loading

Error: [Treasure Data][Presto] (1060) Presto Query Error: Value Cannot Be Cast To Date: Yyyy/mm/dd (9)

Date de publication: Feb 5, 2025
Description

When creating an extract or using a date/datetime field in a view with Treasure Data (Presto) data source, the following error occurs:
 

Error: [Treasure Data][Presto] (1060) Presto Query Error: Value cannot be cast to date: yyyy/mm/dd (9)
 

Cause

SQL cast(substring(datetime,1,10)as date) not working properly

 

Résolution
When [field] is Date type, change it to String type in Tableau Desktop and use the calculation like this to create Date/Datetime field.

Example 1:
DATE([field])

Example 2:
IF CONTAINS([field],'-') THEN MAKEDATE(INT(SPLIT([field],'-',1)),INT(SPLIT([field],'-',2)),INT(SPLIT([field],'-',3)))
ELSEIF CONTAINS([field],'/') THEN MAKEDATE(INT(SPLIT([field],'/',1)),INT(SPLIT([field],'/',2)),INT(SPLIT([field],'/',3)))
END

*The calculation above may not be supported if you use ODBC driver. Use extract instead or connect with Presto connector to avoid it.
Numéro d’article de la base de connaissances

001472400

 
Chargement
Salesforce Help | Article