Hi Looker,
At Werkspot, we have 1 explore that has a plain table filled with (day)dates from 2013 until 2030 as a base.
The rationale is that we quite often create reports with Forecast numbers and therefore we want to be able to create reports with dates in the future.
Moreover: I would love to define a primary key on this date-view, because I want Looker to prevent to do an unnecessary “Group By” (when I create a report on day-level).
However, I cannot do this on a dimension_group level; it should be on a dimension level.
This is what I came up with:
- dimension: date_date
primary_key: true
type: date_date
sql: ${TABLE}.date
- dimension_group: date
type: time
timeframes: [time, week, week_of_year, day_of_week, month, quarter, year]
sql: ${TABLE}.date
However, for the end user this is not ideal, because we now have 1 dimension and 1 dimension-group.
How can I define my primary_key in a way that for the end-user the primary key (in this case: date_date) is simply shown in the dropdown list, together with all the other date-fields?
Thanks, Willemijn.