What format does a Google Data Studio DATE field expect from the connector?

2.5k Views Asked by At

I am building a Google Data Studio connector with a field called date. The field's type is YEAR_MONTH_DAY. Now, when I return a string, for instance "2020-09-22", the field shows null as a result. What value should my connector provide to have Data Studio recognize it as a date?

3

There are 3 best solutions below

1
On BEST ANSWER

"2020-09-22" is of type YEAR-MONTH-DAY, not YEAR_MONTH_DAY

Without knowing the specifics of the connector you are using:

  • Be careful theat your provided format matches the expected one
  • Read about supported Dates and times in Data Studio
  • If necessary, use date formatting methods like e.g. TODATE
  • If the DATE field you are talking about is the absolute date as mentioned here, the expected format is YYYYMMDD.
0
On

For some reason I have had to implement a workaround for this more often lately which is to create a new field in the data source and use the TODATE() function and use that new field in my dimensions on the report.

Try a formula field like:

TODATE(comp_pd_end, "%Y-%m-%d", "%Y%m%d")
1
On

The expected date format for the connector is YYYYMMDD, without any separator.

You can check the official documentation: https://developers.google.com/datastudio/connector/reference?hl=en#semantictype