Type alias KpiComparison
KpiComparison: {
type:"previous-period"; } | {type:"delta";value:CalculatedMeasureColumn|MeasureColumn|StyledMeasureColumn; } | {target:CalculatedMeasureColumn|MeasureColumn|StyledMeasureColumn|number;type:"target"; } | {type:"value";value:CalculatedMeasureColumn|MeasureColumn|StyledMeasureColumn; }
What the KPI headline value is compared against. Each variant carries its own baseline, so invalid combinations are unrepresentable.
Variants:
{ type: 'previous-period' }— compares the last category bucket against the one before it. Requires KpiChartDataOptions.category.{ type: 'delta', value }— compares against a second measure, reporting the difference and the percent change with an up/down arrow.{ type: 'target', target }— treats the baseline as a goal and reads out progress toward it, e.g. '82% of goal' with '$12K to go'. Accepts a measure or a fixed number.{ type: 'value', value }— shows a second measure's value beside the headline, with no delta math and no delta coloring.
For the measure-backed variants, wrapping the measure in a StyledMeasureColumn lets its numberFormatConfig format the readout — the delta for 'delta', the amount-to-go for 'target'. Both fall back to the headline value's own format config.
Example
Against the preceding period:
comparison: { type: 'previous-period' }
Example
Against a fixed goal:
comparison: { type: 'target', target: 250000 }