I would like to create a date range that is bound to a default day. When I try creating a default within the date range itself it seems to be "hard coded" to a specific period. For example when trying to configure a default value it just sets the controls date to a fixed period:
"is in range" | yyyy-mm-dd to yyyy-mm-dd |
I want:
"is in range" | 2 days ago to 1 day ago |
Is that possible?
The control is bound to a filter, but the default value here doesn't seem to do anything.
filter: date_range_param {
type: date
default_value: "yesterday"
}
Note, I would like to use a date range control as users of the report would like a really easy way to change the reporting period to be the first of the month to an ending period.
The date range control seems to be the easiest way to do this. (or I had hoped)
Hi @jredl!
This is possible with Looker filter expressions to set the default filter date to a relative date. This documentation is helpful for different day filters. You can use the filter expressions in the linked documentation in LookML or also in your UI filters with the matches (advanced) filter option. For example if you wanted to do "2 days ago to 1 day ago" your default filter value would look like below:
filter: test_date {
type: date
default_value: "2 days ago for 1 days"
}
The default_value of "yesterday" you currently have will also work but the reason why it's not changing the default value in the dashboard is because setting the default_value in the LookML sets the value for the filter when it's first selected in the Explore. Once you add that filter to a dashboard the default value on the dashboard is then controlled by editing that filter within the dashboard (see gif below changing the filter to 1 complete day ago). If you want to filter based on months this months section of the documentation may be helpful.