I have a series of int values and I want to transform it into a series of percentages:
how much % of all values within 1h windows are within for ex. 100 and 200?
data = from(bucket:"ints")
|> range(start: -24h)
all = data
|> aggregateWindow(every: 1h, fn: count)
count = data
|> filter(fn: (r) => r._value > 100 and r._value < 200)
|> aggregateWindow(every: 1h, fn: count)
join(
tables:{all:all, count:count},
on:["_time"], // you probably need to add tags here based on your data
)
|> map(fn:(r) => {_time: r._time, _value: r.count / r.all})