...

# 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.