7.10 Calculate using adjacent row/interval when data of the same group is continuous (link relative ratio and YOY)
Here below is an annual and quarterly sales data table:
Now we want to calculate LRR and YOY (calculate in cell D1):
A | |
---|---|
1 | =E(‘A1:C21’) |
2 | =A1.(Sales-Sales[-1]) |
3 | =A1.group(Year) |
4 | =A3.(~.(Sales-A3.~[-1](#).Sales)).conj() |
5 | return A2.new(~:LinkRelative,A4(#):YOY) |
A2: Calculate LRR, [-1] represents the previous row.
A3: Group by Year.
A4: Calculate YOY. The symbol ~ represents the current member in the loop function, and # represents the sequence number of current member in loop function.
esProc Desktop and Excel Processing
7.9 Accumulation for continuous occurrence of a certain condition
7.11 Calculate using adjacent row/interval when data of the same group is discontinuous (LRR/YOY in the case of missing data)
SPL Official Website 👉 http://www.scudata.com
SPL Feedback and Help 👉 https://www.reddit.com/r/esProc
SPL Learning Material 👉 http://c.scudata.com
SPL Source Code and Package 👉 https://github.com/SPLWare/esProc
Discord 👉 https://discord.gg/ydhVnFH9
Youtube 👉 https://www.youtube.com/@esProc_SPL