YOY_REL
Category: Compare periods
Overview
Description | Returns the relative growth for each year compared to the previous year (year-over-year). Use this when you need the percentage change between consecutive years. |
Syntax |
|
Parameters |
|
Examples
Default: ignoring missing values
This example shows YOY_REL with the default behavior. The missing year 2029 is skipped and its following year 2030 is not calculated.
Input node: Profit
Year | Value |
|---|---|
2025 | 200 |
2026 | 300 |
2027 | 450 |
2028 | 500 |
2030 | 100 |
Formula: YOY_REL('Profit') = YOY_REL('Profit', "IGNORE_MISSING")
Year | → YOY_REL Result |
|---|---|
2026 | (300 - 200) / 200 = 0.5 |
2027 | 150 / 300 = 0.5 |
2028 | 50 / 450 = 0.11 |
The function outputs the ratio between the difference and the previous year's value. The missing year 2029 is ignored and 2030 is not calculated.
Treating missing values as zero
With MISSING_AS_ZERO, gaps are filled with 0. This produces results for every year but can cause division by zero when the previous year has no data.
Formula: YOY_REL('Profit', "MISSING_AS_ZERO")
Year | → YOY_REL Result |
|---|---|
2026 | (300 - 200) / 200 = 0.5 |
2027 | 150 / 300 = 0.5 |
2028 | 50 / 450 = 0.11 |
2029 | (0 - 500) / 500 = -1 |
| (100 - 0) / 0 = division by zero results in entry not being present in result |
2025 | (0 - 100) / 100 = -1 |
The missing years 2029 and 2025 are calculated as having value 0. This leads to negative values for 2029 and 2025, and a division by zero error for 2030.