Skip to content

Show Percentages

Percentages explain how much a group contributes to a larger total. For example, if North sells 600 out of 1,000, its share of all sales is 60%.

Interactive example

Show each region’s share

Compare sales amounts with their share of the grand total.

Try it: Choose Share of total, then Sales amounts.

The example loads when visible.

What to notice: North contributes 60%, South 30%, and West 10%.

Compare the normal sales amount with its share of the grand total. The records are unchanged; the measure applies a calculation after aggregation.

import type { PivotConfig } from '@revolist/pivot';
const values: PivotConfig['values'] = [{
id: 'sales-share', prop: 'sales', aggregator: 'sum',
label: 'Share of sales',
calculation: { type: 'percentOfGrandTotal' },
format: { preset: 'percent', options: { maximumFractionDigits: 1 } },
}];

The calculation produces a fraction such as 0.6; the percent format displays 60%. Applying only a format to the original amount does not calculate a share.

CalculationDivide by
percentOfGrandTotalThe full applicable total
percentOfRowTotalThis row’s total across columns
percentOfColumnTotalThis column’s total across rows
percentOfParentRowTotalThe parent row group’s total
percentOfParentColumnTotalThe parent column group’s total

A source filter changes the records included in these totals. Collapsing a group, hiding totals, paging, or filtering results does not recalculate the denominator from the visible cells alone. A zero denominator produces a missing result, rather than infinity.

Calculated values covers comparisons, running totals and formulas. Read aggregation policies for exact calculation scope, or chart formatting to display the same shares in charts.