I have a formula that I would like to apply row-by-row, so that only the current and previous rows in any given row are included in the calculation. Consider the following data:
data:([]dt:2017.01.05D19:45:00.238248239 2017.01.05D20:46:00.282382392 2017.01.05D21:47:00.232842342 2017.01.05D22:48:00.835838442 2017.01.05D20:49:00.282382392;sym:`AAPL`GOOG`AAPL`BBRY`GOOG;price:101.20 800.20 102.30 2.20 800.50;shares:500 100 500 900 100) data: dt sym price shares 2017.01.05D19:45:00:238248239 AAPL 101.20 500 2017.01.05D20:46:00:282382392 GOOG 800.20 100 2017.01.05D21:47:00:232842342 AAPL 102.30 500 2017.01.05D22:48:00:835838442 BBRY 2.20 900 2017.01.05D20:49:00:282382392 GOOG 800.50 100
The formula select sum price from data where i=(last;i)fby sym will give the result that I need, however it will only give 1 datapoint. I need this calculation made on each row of the data set.
Scanning ("\") applies this behavior, but unfortunately I do not know how to do this when using select statements.
source share