Filter If / Conditionally Filter / How can I filter only if a user doesn't use a filter?

Knowledge Drop

Last tested: Sep 27, 2019
 

You can do this by using the `conditionally_filter' LookML parameter .

This would be an explore level parameter (you would put it in the model file, in the definition for a given explore, and it would apply to that explore and all tiles or looks that use that explore as a base). Syntax looks like:

# this is the explore the

# conditional_filter param applies to

explore: explore_name {

# declare a conditional filter

conditionally_filter: {

# you can specify multiple filters, by adding new filters:{} blocks

filters: {

# the field to conditionally filter on

field: field_name

# the default value to filter for

value: "Looker filter expression"

}

# unless holds a comma delimited lis

# of fields (dimensions or measures)

# that a user can filter on to avoid

# the conditional filter.

unless: [field_name, field_name, …]

}

}

One important note is that this filter will apply even on dashboard tiles and Looks, however the end user will not see the filter generated by the conditional filter in the filter drop-down.

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 01:15 PM
Updated by: