Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

Casting string to date

Hi,

I have a date field in the format yyyy-mm-dd and in string type. How do I convert the string type to date type in looker?

I tried using cast and also datatype fields, giving an error.

Lookml code - dimension: e_date {
                              type: date
                              datatype: date
                              sql: CAST(${TABLE}.e) ;;
                          }

Error - Query execution failed: - Syntax error: Unexpected ")" 

How to resolve this error?

Thanks in advance.

0 1 14K
1 REPLY 1

What is your dialect? You forgot to include what you are casting to

CAST(${TABLE}.e AS DATE)
Top Labels in this Space