Filter by value allows filtering records based on values of a certain measure. For instance, you can show the top 3 products with the highest sales or revenue.
Learn more about the filter by value:
Filter by value consists of a measure to filter by, a condition applied to the measure, and values for the condition. Here is an example of a value filter, where Sum of Price is a measure to filter by, Top is a filtering condition, and 5 is a condition value:
Value filter can be applied only to fields in rows and columns, not in report filters. This filter is also incompatible with the conditional and selection filters.
The filter by value is available for the following data sources:
Note For the custom data source API, the filter by value must be implemented on your server. For more details, refer to the Implementing filters guide.
The following filtering conditions can be applied to a measure:
The filter by value can be:
Step 1. Open the filter view by clicking the field’s name or using the field’s context menu.
Step 2. Select the VALUES filtering option. This will open a subview where you can specify the filter by value.
Step 3. In the subview, choose a measure to filter by from the dropdown menu. Then, choose a filtering condition and enter a value for it.
The screenshot below shows an example of a filter configuration:
Step 4. Once the filter is configured, click the APPLY button to save your configuration.
If you want to preset a filter in your report, we recommend the following approach:
If needed, you can edit the filter configuration programmatically. To learn more, see the API reference:
To set or change the filter at runtime, use the setFilter() API call:
flexmonster.setFilter("Country", { measure: { uniqueName: "Price", aggregation: "sum", }, query: { top: 5, }, });
You can view the existing filter configuration using the getFilter() method.
Try a live sample on JSFiddle.
Learn how to clear the filter by value:
Step 1. Open the filter view by clicking the field’s name or using the field’s context menu.
Step 2. Select the Clear value filter option located in the lower-right corner of the subview:
Step 3. Click the APPLY button to save your changes.
You can clear all filters from a field using the clearFilter() API call. For example:
flexmonster.clearFilter("Country");
Try a live sample on JSFiddle.