I was searching for an answer for this rather easy problem but surprisingly I was unable to find solution.
I have two measurements, from two the same type sensors, they just differ by the id. Both of them have sligtly different readings - but this is ok. I want to graph single arithmetic mean value from both of them - a+b/2 of each reading. Is it possible, if yes - how to do it? ![]()
I’m scratching head for long, but I think i’m missing something very obvious…
Hello @tomeq82,
Welcome!
What are you hoping to query with? Flux?
first = from(bucket: "your bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "a" )
second = from(bucket: "your bucket")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "b" )
join(tables: {first: first, second: second}, on: ["_time", "_field"], method: "inner")
|> map(fn: (r) => ({ r with _value: (r.first_value + r.second_value)/2 }))
Hope that helps
