business analytics
slug: step-contributionAnalyzes how each segment contributed to change between time periods. Answers the executive question: "What drove the change?"
compareBy dimensioncompareBy (string) - The time dimension column name (e.g., "quarter", "month", "year")measure (string) - Which measure to analyze (e.g., "revenue", "units")metric (string) - Which metric of the measure (e.g., "sum", "mean")output (string) - Output dataset name. Default: "contribution"compareBy column{measure}.{metric} (e.g., "revenue.sum")All original columns are preserved, plus:
transition - Period pair identifier (e.g., "Q1-2024_to_Q2-2024")baseValue - Measure value in the first (base) periodcompareValue - Measure value in the second (compare) period contribution - Absolute change (compareValue - baseValue)contributionPct - Percentage of total change this segment representsgrowthRate - Percentage change from base ((contribution / baseValue) × 100)Note: contributionPct is calculated within each level so that segments at the same aggregation level sum to 100%.
| category | region | level | transition | baseValue | compareValue | contribution | contributionPct | growthRate |
|---|---|---|---|---|---|---|---|---|
| Electronics | West | 2 | Q1-2024_to_Q2-2024 | 50000 | 60000 | 10000 | 200.0 | 20.0 |
| Books | East | 2 | Q1-2024_to_Q2-2024 | 30000 | 28000 | -2000 | -40.0 | -6.7 |
| Clothing | West | 2 | Q1-2024_to_Q2-2024 | 20000 | 22000 | 2000 | 40.0 | 10.0 |