Use _value in custom function in Flux - InfluxDB
09:13 14 Dec 2025

Using Flux, how to add the _value in a custom functions ?

For example, say I want to divide the obtained _value by 4. This does not work:

myFunction = (x=<-) => x / 4
from(bucket: "myBucket")
  |> range(start: -5m)
  |> filter(fn: (r) => r._measurement == "foo" and r._field == "bar")
  |> myFunction(_value)

How to formulate |> myFunction(_value) ?

I don't have any practical problem. It is just for learning purposes.

influxdb