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%.
Try percentage sales
Section titled “Try percentage sales”Show each region’s share
Compare sales amounts with their share of the grand total.
Try it: Choose Share of total, then Sales amounts.
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.
Configure a percentage measure
Section titled “Configure a percentage measure”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.
| Calculation | Divide by |
|---|---|
percentOfGrandTotal | The full applicable total |
percentOfRowTotal | This row’s total across columns |
percentOfColumnTotal | This column’s total across rows |
percentOfParentRowTotal | The parent row group’s total |
percentOfParentColumnTotal | The 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.
Next steps
Section titled “Next steps”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.