Applying a Group Filter from a Custom Metric
Suppose you want to find product purchases made by males within certain areas of Los Angeles, while also comparing their income levels. Specifically, you are interested in men whose sales average more than $100,000. You might create a filter using the following steps. This example requires that you have already applied a row-level filter for the city of Los Angeles.
Since you do not have a custom metric created yet for average sales, one needs to be created.
To create the custom metric:
- Click the filter icon () on a chart.
- Click on the Filter panel (sidebar).
- Click and select Add Custom Metric from the resulting menu. The Custom Metrics Editor appears.
- In the Function Library, double-click AVG(field).
- In Attributes & Metrics, select Sales.
- Select Run Custom Metric to see a preview of the results.
- Name your custom metric and select Save.
- Close the Custom Metrics Editor.
Now that you have created and successfully saved the custom metric you want to use, you can apply it to the chart or dashboard.
To filter your data by the aggregated field:
- Click in the upper left of the chart or dashboard. The Filters sidebar appears.
- Ensure that the row-level filter for males in Los Angeles is applied.
- Click .
- From the list of available attributes, select Zipcode.
- Choose the zip codes you want to include in your results. For example, all of the 900 zip codes or 90211, 90305, and 90701.
- Click Apply.
- Click .
- Select the Group tab.
- Select your saved custom metric from the list of available custom metrics for use.
- Select the Operator tab and then click the greater-than (>)operator.
- In the value field, enter 100000 and then click Apply. In the Filters sidebar , you can see all the filters you have applied thus far.
- On the chart canvas, select Group and ensure Product Category is selected for an attribute.
- To view the differences in average sales for products, simply filter on different income brackets. For example, apply a filter for incomes between $50000 to $75000.