I have some experimental data that takes a measurement every minute for 10 minutes.
I then want to take an average for a subset of data points in the middle of the set.
My solution is to have a hidden column (:Range) with a formula that contains the criteria (input via a modal window) and sets each row as either 1 or 0 if it's to be included in the calculation.
My output column then uses the Col Mean function to take the average of the points of interest.
This part is working great, but I also want the first blank row (not included in the calculation) to take the value of the next row, which will help with further data manipulation down the line. I've added the Lag function as below.
If( :Range == 1,
Col Mean( :Measurement, :ID, :Range ),
Lag( :Measurement, -1 )
)
The issue is that when I run this as a script, the Lag function does not work. If I manually enter the formula above it works fine, but the below script only populates rows where :Range == 1, despite the fact I can see the formula is correctly applied to the column.
New Column( "Mean Measurement", Formula(
If( :Range == 1,
Col Mean( :Measurement, :ID, :Range ),
Lag( :Measurement, -1 ))))
Is there any reason for this, and any way I can force the column to re-evaluate the formula to run properly?
Note, the rerun formulas function does not seem to do anything