I have a function which takes the 1st value from a masurement every 5mins.
ever5Mins1st = from(bucket: "Historian/oneday") |> range(start: dashboardTime) |> filter(fn: (r) => r._measurement == "InventoryStock" and r._field =="Value" and r.Location=="NYC" ) |>window(every:5m) |>first() |>window(every:inf)
Now If I want to do a difference of two consecutive points , I can do by using difference function
But what If I do I want a sum of every consecutive points or every 5 points.
I know I can write custom functions which recieves piped data. But do I need to write a for loop? Are there any examples of for loops and conditional statements?
// Function definition add = (tables=<-) => tables |> map(fn: (r) => //What should I do here, for loop?)
Or this has to be a custom function created in Golang and then contribute to the open source?