from(bucket: “quote”)
|> range(start: -10m)
|> filter(fn: (r) => r._measurement == “domestic” and r._field == “volume”)
|> group(columns: [“stockCd”])
|> aggregateWindow(every: 1m, fn: sum)
|> fill(value: 0.0)
|> set(key: “_measurement”, value: “1m”)
|> group(columns: [“stockCd”])
|> map(
fn: (r) =>
({r with
_value: r._value / previous value // previous record value
}),
)
Hello guys, I want to obtain the result of calculating the current value as shown above and the value of the previous record. What query should I use to fetch the value of the previous record?