Skip to content

Sort a Pivot Report

Sort group labels to make a report easy to scan, or sort by a summary to put the largest values first. Sorting changes order; it does not remove records or change the total.

Interactive example

Sorting and filtering

Order generated row/column members while preserving hierarchy

The example loads when visible.

Choose the sorting example to compare ordering by member label with remote summary ordering. Use source filters when you want to narrow the report instead.

import type { PivotConfig } from '@revolist/pivot';
const dimensions: PivotConfig['dimensions'] = [
{ prop: 'region', name: 'Region' },
{ prop: 'quarter', name: 'Quarter', sortable: true, order: 'asc' },
{ prop: 'sales', name: 'Sales' },
];

Dimension metadata controls the ordering available to generated column members. Native row sorting uses the grid’s grouping behavior. See field metadata for inherited column options.

For programmatic analytical queries, use a configured stable measure ID with bySummary:

await controller.replaceQuery({
sort: [{ selector: 'region', bySummary: 'sales-total', desc: true }],
});

Here controller is a headless controller whose report defines the measure ID sales-total. This is not a method added to the grid. For a custom interface attached to a grid, use the authoring integration.

Summary sorting scores each hierarchy prefix against the opposite-axis grand total. It does not mean sorting by an arbitrary clicked column tuple. Read summary-sort scope before exposing it through a custom UI.

The request’s sort descriptors go to the backend, which must sort complete groups before pagination. A Boolean capability flag is not an implementation of all summary-sort profiles. See remote requests.

Show the top or bottom groups, filter source records, or configure chart data.