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:
The following filtering conditions can be applied to a measure:
The filter by value can be:
Note If you want to preset a filter in your report, we recommend the following approach:
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.
Step 1. In the slice, add the filter
property to the field you want to filter. The field can be from the rows
or columns
.
Step 2. Specify the filter.query
property. A list of available conditions for this property is described in the ValueQueryObject.
Step 3. Specify a measure to filter by in the filter.measure
property. The measure must be defined in the slice. Calculated measures can be used as well.
Here is an example of how the filter can be defined:
slice: { rows: [ { uniqueName: "Country", filter: { measure: { uniqueName: "Price", aggregation: "sum", }, query: { top: 5, }, }, }, ] }
Check out the live demo on JSFiddle.
Note Filter by value can contain only one condition at a time.
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.
Note Filter by value can contain only one condition at a time.
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.