Skip to content

Filter Calculated Results

A result filter answers a question such as which regions have total sales above 300? Pivot first groups and calculates the records, then tests each summary.

Interactive example

Find regions over a sales target

Filter calculated region totals rather than individual orders.

Try it: Choose Regions over $300.

The example loads when visible.

What to notice: North qualifies with $600; South and West are hidden.

Apply the threshold and compare the groups that remain. Clear it to restore the report. This is different from filtering individual source records.

import type { PivotConfig } from '@revolist/pivot';
const config: Partial<PivotConfig> = {
rows: ['region'], columns: [],
values: [{ id: 'sales-total', prop: 'sales', aggregator: 'sum' }],
resultFilters: {
summary: { id: 'sales-total', selector: 'sales', summaryType: 'sum' },
columnPath: [], columnKind: 'leaf',
operation: '>', value: 300,
},
};

Give the measure a stable id and reference it with summary.id. columnPath and columnKind identify the summary coordinate to test; the empty path above is for a report without column grouping. See the configuration reference for the complete contract.

Totals are calculated at their own scope; they are not necessarily the sum of retained displayed cells. Hiding a group with a result filter does not redefine a percentage denominator. Use a source filter when the selected records should define a new analysis population.

A backend must support the requested summary identities and result-filter capability. Do not filter only the current returned page: groups on other pages may also qualify. See remote query capabilities.

Top and Bottom Results selects a number of leading groups. Sorting changes their order. Chart filters control what a chart displays.