Question

Cascading Filters using LookML?

  • 6 September 2018
  • 8 replies
  • 1104 views

Is there any way to add a cascading effect for filters in LookML? I have seen previous posts from a few years ago and the syntax is not working for me.


For example if I have filters Car Make and Car Model and I select a Make, then in the Model filter only the car models for the selected car make should appear.


8 replies

Hi Ryan,


Yes, we can do this with Looker. If the underlying tables have one row for each car model, filtering on car make should only return the rows of cars that meet that car make filter condition. Without being able to see exactly how your data is structured, it is a little difficult to help.


You can reach out to us at help.looker.com, or on chat, and we would be more than happy to work through this with you!


Noah

Hi Noah - I am referring to the values that appear in the filter drop downs. By default, they do not cascade, is there a way to give cascading functionality within LookML?


Example: I select “BMW” as Car Make, click RUN, then click into the Car Model filter but still see all possible models regardless of Car Make. I would like to ONLY see BMW Car Models in the dropdown:

image

Userlevel 3

Hi Ryan,


We can do this with faceted filters in dashboards: https://docs.looker.com/dashboards/adding-filters-to-user-dashboards#faceted-filters


We’ll just use the dashboard filter of type “Field”


Best,

Molly

Userlevel 2

Can i do it in a look rather than in a dashboard?

Userlevel 3
Badge

@molly.lippsett  have the same question, is it possible to do it in a look vs a dashboard?

Userlevel 3

@David_P not possible to do faceted filters in Looks - but you could always add your look to a dashboard and just a use it as a single-tile dashboard. 

Userlevel 6
Badge

I have been really trying to get this working using NDT’s, derived tables, parameters, suggest_explores, multiple views/explores and combos of all the above! It seems to me that Looker has made up its mind on the sql it intends to run to fetch filter suggestions before the user has even selected values for the parameters.

 

For example. My driving filter is set to a value (lets use colour and fruit as an example) - lets say red.

When I add fruit as a dimension to the analysis the derived table correctly renders the derived table sql as “select fruit from myTable where COLOUR = RED” …...HOWEVER when the filter suggestion query runs for fruit it runs the where condition using the colour parameters default value.

 

I really need to get this working so wondered if anyone had a crazy way of doing this. I need this done in the explore as I need the filter values for colour and fruit to drive the fields and tables I am looking at. For example I need to run a query containing this information...ie. select strawberry from myschema.red (with strawberry and red being selected by the user as filters).

 

My fallback solution which I am not happy with is to have a parameter containing both dimensions (eg. Red - Strawberry, Red - Apple...) and then pulling apart that value and making use of its parts. poor UX though.

Hi @IanT , you may have already found this by now, but within a dashboard you can use linked filters to do this quite quickly.

 

https://docs.looker.com/dashboards/dashboard-beta-filters#setting_up_linked_filters

 

This may not be relevant if you require it at the explore level though.

Reply