Loading

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

Publiseringsdato: Feb 5, 2025
Beskrivelse

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

 

Løsning
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.
Knowledge-artikkelnummer

001472400

 
Laster
Salesforce Help | Article