Flux and math operations

Hello all,

i migrated to InfluxDB2.1 and use now FLUX.
in the past (with old version) it was possible to collect 2 DIFFERENT values of different datapoints and subtract them from each other.
How ist this possible in InfluxDB2.1 with FLUX ?
I also used the WebUI of InfluxDB2.1 but didn’t find a way to do that.

Any hint is very welcome !

from(bucket: "bucket2")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "measurement2")
  |> filter(fn: (r) => r["EquipElement"] == "zone2")
  |> filter(fn: (r) => r["EquipNumber"] == "6")
  |> filter(fn: (r) => r["EquipType"] == "furnace")
  |> filter(fn: (r) => r["MeasType"] == "actual" or r["MeasType"] == "setpoint")
  |> filter(fn: (r) => r["_field"] == "temperature")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> pivot(rowKey:["_time"], columnKey: ["MeasType"], valueColumn: "_value")
  |> map(fn: (r) => ({ r with alm: (r.setpoint - r.actual) }))
  |> keep(columns: ["_time", "alm"])

The last 3 lines above create a new value called alm that is the difference between setpoint and actual.