I want to count amount of values that are greater than specific value. Data:
from(bucket: "bucket name")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._value > 35)
|> count()
If there are no values in the processing data range that are greater the specified value than the influx returns nothing (no data).
Solution with a little trick...
Instead of filter()
and count()
- need to use map()
and sum()
from(bucket: "bucket name")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> map(fn: (r) => ({ r with _value: if r._value 35 then 1 else 0 }))
|> sum()