When my query return no results, i would like to put 0 instead of nothing. Here’s my query:
from(bucket: “Bacnet_Network”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == “048_STEM”)
|> filter(fn: (r) => r[“room_system”] == “AHU16”)
|> filter(fn: (r) => r["_field"] == “value”)
|> last()
|> filter(fn: (r) => r.sensor =~ /DMP/ and r._value <= 75.0)
|> group()
|> count()
|> map(fn: (r) => ({r with _dmp_max: float(v: r._value) / 7.0 * 100.0}))
|> mean(column: “_dmp_max”)
Thx!