Multiply single column in multi column query for dashboard

Hi there,

i fail to distinctively applying a multiplication to a single column in a multi column request.

The request looks like:

from(bucket: "excesspv")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "boiler")
  |> filter(fn: (r) => r["_field"] == "power_house" or r["_field"] == "set_power" or r["_field"] == "target_power")
  |> filter(fn: (r) => r["location"] == "Hinterkirch 3")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")

I would like to apply the multiplication to the field “power_house” and leave “set_power” and “target_power” untouched.

How can I do that?

Thanks in advance,
Lukas

Hello @lukasstein,
Welcome!
I apologize for the delay.
You’re going to want to do something like:

from(bucket: "excesspv")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "boiler")
  |> filter(fn: (r) => r["_field"] == "power_house")
  |> filter(fn: (r) => r["location"] == "Hinterkirch 3")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "aggregated powerhouse")

from(bucket: "excesspv")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "boiler")
  |> filter(fn: (r) => r["_field"] == "set_power" or r["_field"] == "target_power")
  |> filter(fn: (r) => r["location"] == "Hinterkirch 3")
  |> yield(name: "untouched")
1 Like