How to apply filters to specific measures / shelf elements and not entire visual

As explained in our training video on parameters, we can control how filters get applied by writing custom shelf expressions.

In this example, we want to show how we can avoid filtering the entire visual but instead customize which measures get filtered during the aggregation.

Here’s our sample data, Date Year is going to be the dimension we want to use for filtering:


  1. To aggregate specific measures based on filter values, we will use custom parameter expression like the following:

     sum(if([Date Year] in (<<Date''>>), [Sales], 0))
  2. Notice that we have enabled “explicit scope” parameter setting panel on the right. And we created two shelf elements with the custom sum-if expression. For the Sales & Revenue.

  3. Now in our dashboard when we make selections in the Date Year filter, that will set parameter “Date Year”, which then gets used in our custom expression for sales & revenue.

  4. Notice how Profit aggregate never changes and always shows the same value even after making other Year selections: