Create and recall variables

Hello,

i will create a if-Clausel and work with different variables in the same query, but if i want to recall the variable Grafana didnt’t use the variable. Only the variable in the case of the if clausel. Here is my Code. Can someone tell me how i can recall a variable?

Code:

Mess_2_En =
from(bucket: “01_Ullrich_Kunststoffbeschichtung”)
|> range(start: -15d)
|> filter(fn: (r) => r[“_measurement”] == “Messstelle2”)
|> filter(fn: (r) => r._field == “Pges(kW)”)
|> last()

from(bucket: "01_Ullrich_Kunststoffbeschichtung")
    |> range(start: -15d)
    |> filter(fn: (r) => r["_measurement"] == "Messstelle1")
    |> filter(fn: (r) => r._field == "Pges(kW)")
    |> last()
    |> map(fn: (r) => ({r with _gogo: if r._value <= 0.0 and r._value_Mess_2_En > 0.0 then 5 else 6}))