Hello!
I would like to multiplication and addition.
from(bucket: "Test")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "PV")
|> filter(fn: (r) => r["Wechselrichter"] == "1" or r["Wechselrichter"] == "2")
|> filter(fn: (r) => r["String"] == "1" or r["String"] == "2")
|> filter(fn: (r) => r["_field"] == "current" or r["_field"] == "voltage")
So I get 4 values:
Wechselrichter 1, String 1, current
Wechselrichter 1, String 1, voltage
Wechselrichter 1, String 2, current
Wechselrichter 1, String 2, voltage
Wechselrichter 2, String 1, current
Wechselrichter 2, String 1, voltage
Wechselrichter 2, String 2, current
Wechselrichter 2, String 2, voltage
At the end, I would like:
Power 1_1 = Wechselrichter 1, String 1, current * Wechselrichter 1, String 1, voltage
Power 1_2 = Wechselrichter 1, String 1, current * Wechselrichter 1, String 1, voltage
Power 2_1 = Wechselrichter 1, String 1, current * Wechselrichter 1, String 1, voltage
Power 2_2 = Wechselrichter 1, String 1, current * Wechselrichter 1, String 1, voltage
Sum = Power 1_1 + Power 1_2 + Power 2_1 + Power 2_2
I tried with pivot and map but not able to get a result.
Thank you!