Filter out Values of Attribute Filters

You can restrict particular values of an attribute filter (see Filter for Attributes) so that they do not appear in the list of values and a user cannot see or select them.

To do so, add one or more metrics to the attribute filter. Based on the added metrics, the filter drop-down shows only the values for which at least one of the metrics returns a non-zero value.

How This Works

You have a report with a number of sold products sliced by city.

The report has a filter applied at the report level to show only the products sold in Italy.

The report is placed on a dashboard that has an attribute filter for cities. By default, the filter shows all cities from the dimension, not only Italian cities.

Goal:  You want the city filter to show only those Italian cities that have at least one sale (that is, a non-zero value).

Solution:  Add a metric to the city filter’s configuration to limit the filter values. This metric returns the number of orders in Italian cities. If the number of orders for the city is greater than 0 (zero), the city appears as a value in the attribute filter drop-down.

SELECT COUNT(OrderID) WHERE Country=IT

Results:

Let’s compare side by side the original version of the filter values to the version with the metric applied:

Behavior Considerations

Select All

Clicking Select all in an attribute filter with the added metrics overrides all limitations that the added metrics bring. In this case, all the filter values are displayed in the report, including those values that were hidden as irrelevant (even if they are not visible in the filter dropdown). The whole filter then behaves as if it was not applied. The same behavior is observed when All is the default value of the filter (for the filters where multiple values are allowed to be selected).

In the context of the example provided in this topic, clicking Select all in the city filter allows the report on the dashboard to show all cities, not only those with non-zero values for sales and not only Italian cities.

Element Masking

Filtering out values of attribute filters as a feature is not compatible with element masking (see Element Masking). Filtering out values applied together with element masking within the same dashboard may result in unexpected behavior of dashboard reports and filters.

How to Filter out Values of Attribute Filters

Steps:

  1. Open your dashboard for editing.
  2. Select the filter for which you want to filter out values based on metrics.  For information about creating attribute filters, see Filter for Attributes.
  3. Click the Gear icon that appears above the filter. The filter’s configuration opens.
  4. Click Available Values, then click Add Metric.
  5. Select the metric from the list.
  6. If needed, add more metrics.
  7. Click Apply to save the filter configuration.
  8. Click Save to save the dashboard.