UReport2 allows for time-series calculations like Month-on-Month (MoM) or Year-on-Year (YoY) by using negative sequence numbers in cell coordinates to look at previous periods.
Month-on-Month (MoM)
To compare the current cell C2 with the previous month's C2, use:
C2 - C2[A2:-1]
Here, A2:-1 tells the system to look at the cell C2 corresponding to the parent A2 that is one position above the current A2.
Year-on-Year (YoY)
To compare the current value with the same period in the previous year, you often need to match a specific dimension (like a month or year name) using a condition.
In UReport2, use the $ prefix inside a condition to refer to the value of a cell relative to the target cell being acquired, rather than the current cell.
Example for YoY:
C2 - C2[A2:-1]{B2==$B2}
B2 (without $) is the value of B2 in the current row.$B2 is the value of B2 in the target cell (the one found via coordinates).- The condition
{B2==$B2} ensures you are only subtracting values from the same month/period.
Note on Defaults: If the coordinate (e.g., A2:-1) does not exist (like in the first row of a report), UReport2 defaults to the current cell's value, resulting in a difference of 0. Use an if expression to handle these cases (e.g., returning an empty string instead of 0).