[TIP 83] Calculating the Difference Between Two Rows in your Data-set

Let's assume you have the following data-set (Ride Number & Speed for each ride):


Image title



How would you go about calculating the speed difference between the different rides like so:


Image title


Here's what we'd do. In your data cube:



  1. Create a copy of your Speed field using the copy element transform

  2. Add a calculated element transform and set an offset of -1 to your Speed field placeholder. You can read more about offsets in placeholders here.

  3. Return a calculation of your Speed column minus the copied Speed column with the placeholder set to -1. For example:


Image title


The entire data cube will look like this: