convert the number 201504 into a date (yyyy.mm.dd) in looker (using bigquery sql)
Jump to turn (8)
- 1convert the number 201504 into a date (yyyy.mm.dd) in looker (using bigquery sql
- 2in looker i want to create a custom field and convert the number into a date
- 3i now want to use the expression of goolge looker for "create custom dimension"
- 4this does not work: FORMATDATE('%Y.%m.%d', PARSEDATE('%Y%m%d', CAST(${vardrbankl
- 5i want to use the looker "date" expression. how do I trim the monatid (yyyymm) i
- 6how do i convert in looker expression a number to a string?
- 7date( substring(tostring(${vardrbankleistungmon.monatid}), 1, 4), substring(tost
- 8cast doesnt work either. vardrbankleistungmon.monatid is a number the has to be
- User
convert the number 201504 into a date (yyyy.mm.dd) in looker (using bigquery sql)
- Assistant
To convert the number
201504into a proper date format (yyyy.mm.dd) in Looker using BigQuery SQL, you need to:- Parse the number as a string,
- Extract the year and month,
- Construct a date with the first day of that month,
- Format the result as
yyyy.mm.dd.
✅ BigQuery SQL Expression
Assuming the field is called
period_number(i.e., has the value201504):sqlFORMAT_DATE('%Y.%m.%d', DATE(PARSE_DATE('%Y%m', CAST(period_number AS STRING))))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.