Dynamically change the time series with filters

  • 11 September 2022
  • 1 reply

Hi everyone, I’m new to Looker, and I need to modify a dashboard in the following way.
At the moment, I have a visualization tile representing net sales per week (week on the x-axis, sales on the y-axis). I can also group the sales by month in the explore tab.

What I need to achieve is to change the time granularity from weeks to months, directly in the dashboard. Basically I want the first chart in the image to change into the second one, to avoid displaying a too many charts at the same time (because I need the same behaviour on many different tiles in the same dashboard).

Is there a way to achieve this using filters/buttons?

Thanks in advance


1 reply

You can achieve that by using parameters and liquid variables:

parameter: date_granularity {
type: unquoted
allowed_value: {
label: "Break down by Day"
value: "day"
allowed_value: {
label: "Break down by Month"
value: "month"

dimension: dynamic_date {
type: string
label_from_parameter: date_granularity
{% if date_granularity._parameter_value == 'day' %}
{% elsif date_granularity._parameter_value == 'month' %}
{% else %}
{% endif %};;