Remapping values in Grafana for higher power states from InfluxDB

hi there,
i get values from an influxdb with e.g 0 = off, 3=bulk, 5=absorption. i just want to remap e.g.3 to 5 an 5 to 4 to get the “higher power” states over the lower power states.
how can i remap the values in grafana?

You could use value mappings, but I don’t know if that will fit your case. Anyway, you can create mapping for every value, e.g.

this just changes the text not the value

ok i added a second influx data source with flux as query language and added the logic there:

  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "ve_direct_victron")
  |> filter(fn: (r) => r._field == "CS_Status")
  |> map(fn: (r) => ({
      r with _value: 
        if r._value == 0 then int(v: 0)  // Off
        else if r._value == 1 then int(v: 1)  // Low Power
        else if r._value == 3 then int(v: 5)  // Bulk (höchster Wert)
        else if r._value == 4 then int(v: 4)  // Absorption
        else if r._value == 5 then int(v: 3)  // Float
        else int(v: r._value)  // Standardfall als int
  }))
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
  |> yield(name: "last")```