Announcements
The Google Cloud Community will be in read-only from July 16 - July 22 as we migrate to a new platform; refer to this community post for more details.

How to associate a dashboard filter to more than one dimension?

At LookML dashboards, the listen parameter of the elements is a one-to-many mapping, but it would be extremely useful to my use case to associate one filter to more than one field. Is there anyway to achieve the same result without the need to replicate the filter?

0 5 82
5 REPLIES 5

Like you said - the "listen" element can be used on several dashboard elements, and can reference the same filter. Sounds like exactly what you're looking for - what am I missing here?

I want to reference the same filter multiple times on the same element, for different fields.
Example:
- title: Element1
  name: Element1
  [...]
  listen:
    DateFilter: date_field1
    DateFilter: date_field2
 [...]
I wanted to do it this way so we could use the same dashboard filter for a filter-only field (https://cloud.google.com/looker/docs/reference/param-field-filter_ ) and for a dimension. Is this possible?

Ah, I see what you mean. No, I don't think it's directly possible to filter on two fields in the same tile with the same dashboard filter. 

Can you tell me more about your use case? You may be able to achieve your goal with templated filters in Liquid. For example, you could write some SQL into your filter-only field that would capture any logic applied to date_field1.

filter: date_field2 {
  type: date
  sql: {% condition date_field1 %} ${TABLE}.date_field2 {% endcondition %};;
}

We tried this approach, but when we try to get the "value" of the filter on other Liquid expressions, it fetches the SQL expression, and not the actual value anymore. Is this expected or am I getting something wrong? Thank you in advance for the help.

Different liquid variables return different values.

  • "Value" returns the sql expression, as you noticed.
  • To return the filter expression, you'd use "_filters['view_name.field_name']". HOWEVER, this doesn't work in "sql" parameters, only "html".
  • To use a filter expression in a "sql" parameter, I recommend "condition" and "endcondition". 

See the Liquid variable reference for more details!

Top Labels in this Space
Top Solution Authors