The Compare tool can be used to move cell values up or down in your dataset. Concretely it helps you look at the previous or subsequent rows relative to your current row. You can think of it as looking back or forward to see what happened before or later in your dataset.
The Compare tool is similar to a LAG function in SQL
The Compare tool has of two required input and one optional input.
1
Select Column(s) to Move
Select the column(s) that contains the values you would like to move vertically in your dataset
2
Input Number of Rows
Input the number of rows backward/up or forward/down that you want to fetch data from relative to your current row. Note that to look forward/down you need to input a negative value.
3
Additional Settings: Group By
This is an optional input. You can use it to segregate what you are comparing with into groups. Check out the Time Since Previous Order example below.
This configuration is similar to a PARTITION in SQL
I want to calculate the month-on-month sales growth
Time Since Previous Order
I want to calculate the average time (measure in days) between my customers making repeat orders
Note that we are fetching one row upward/backwards in the dataset within the customerID group. So while the values might move visually more than one row, it is moving one row “inside” the group - customerID