Table Calculation for year-over-year

Attempting to create a year-over-year table calculation with sales data. One of the main issues I’m encountering is that the number of fiscal weeks can be adjusted as a filter, a user can pick 1 week or 52 weeks. My first attempt was to use a combination of table calculations using pivot_offset and pivot_index. I would then drag the table calculation column into the correct location. The problem I see that this solution isn’t scalable. Is there a way for Looker to dynamically handled a year-over-year calculation where the number of columns (weeks) can change?

Calculation 1: (${sales}/pivot_offset(${sales},1)) -1
Calculation 2: pivot_index(${calculation_1},1)

Data:

Desired State:

0 0 1,472
0 REPLIES 0
Top Labels in this Space
Top Solution Authors