Calculate percentage of values within range


I need some help to come up with a query:

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?

How would you do that in Flux?

Thank you


The basic query will look like this:

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)

    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})