Reputation: 21
I have data in a BigQuery instance with a some date fields in epoch/timestamp format. I'm trying to convert to a YYYYMMDD format or similar in order to create a report in Data Studio. I have tried the following solutions so far:
Change the format in the Edit Connection menu when creating the Data Source in Data Studio to Date format. Not working. I get Configuration errors when I add the field to the Data Studio report.
Create a new field using the TODATE() function. I always get an invalid formula error (even when I follow the documentation for this function). I have tried to change the field type prior to use the TODATE() function. Not working in any case.
Am I doing something wrong? Why do I always get errors?
Thanks!
Upvotes: 2
Views: 4261
Reputation: 19
The function for TODATE()
is actually CURRENT_DATE()
. Change timestamp to DATE using EXTRACT(DATE from variableName)
make sure not use Legacy SQL !
The issue stayed, but changing the name of the variable from actual_delivery_date
to ADelDate
made it work. So I presume there's a bug and short(er) names may help to avoid it
Upvotes: 1
Reputation: 746
As commented by Elliott Brossard, the solution would be instead of using Data Studio for the conversion,use PARSE_DATE
or PARSE_TIMESTAMP
in BigQuery and convert it there instead.
Upvotes: 0