We’re creating a number of explores, looks, and dashboards based on a reference date parameter. We have logic that uses this ‘reference date’ parameter to drive the data selection for our users.
Everything works great. When we add the reference date parameter to the explore & look, the user is restricted to a single date selection (or the user field, which we don’t use), which is what we expect and want. According to Looker documentation, date parameters will only allow a single date selection.
However, when I add this same parameter to a dashboard, the date based filters are not available like in a normal date field, only the ‘advanced’ selection, which exposes all of the date based filter options that we’re trying to avoid.
I’m able to work around this by creating a LookML dashboard, but that makes editing dashboards very cumbersome and we’re trying to avoid doing that.
Is there any way limit a date parameter to a single date on a user defined dashboard?
By any chance did you come up with a solution to this? I'm encountering the same thing.
I have a date parameter and it shows the Control as Advanced but there is still only an option to select a single day. Does your filter have the configuration for the default value showing all the date options (is in the last, is on the day, is before, etc.) ?
When I built my dashboard I thought it was going to allow for selecting more than a single date based on the Control set to Advanced. If there is not a date selected then it defaults to "anyvalue", which is not what I wanted. I ran into the issue of needing to use a single date for the Default Value but not wanting it to be the date I added the filter (if saved on Jan 13, will always be Jan 13).
For my purposes, the date could be any single day from yesterday or earlier, but not today or in the future. The date field that is applied to all the Looks is a dimension_group with a case/when to check the date parameter. If the date selected for the parameter is later than today then it uses current_timestamp_advanced (which subtracts one day from today's date), otherwise it uses the date parameter.
sql:
CASE
WHEN DATETIME({% parameter pop_parameters.select_reference_time_advanced %}) is null
or DATETIME(${pop_parameters.current_timestamp_advanced_raw}) <= DATETIME({% parameter pop_parameters.select_reference_time_advanced %})
THEN DATETIME(${pop_parameters.current_timestamp_advanced_date})
ELSE DATETIME({% parameter pop_parameters.select_reference_time_advanced %})
END
;;
On the dashboard I called the parameter "Select Reference Date" and noted it as the option to choose any date. The Looks use the dimension_group above that always filters by yesterday's date, so for the dashboard it doesn't matter if I set a default value or not on the parameter filter. I chose to display the default value because then the "is on" part is already selected, saving a step for the users. I set the default date to the end of the year so it's not in the past and it should be fairly obvious. I have a tile with HTML to display the selected date and timeframe on the dashboard to provide additional clarity for the users.
or
Default date 12/31/2025
Entering a date in the past on the parameter filter will update the dimension_group on the Looks/Dashboard.
My dashboard is for period over period comparison, and this article helped me get what I wanted it do to actually work https://blog.montrealanalytics.com/the-ultimate-guide-to-period-over-period-analysis-in-looker-f1935... The concept for the date parameter and dimension_group came from this article.