Convert negative numbers to null values

I know how to filter out negative numbers using flux ‘filter(fn: (r) => r[“_value”] >= 0)’.
But what if I would like to replace them with null values? How can I replace negative numbers with null values so that graph would be interrupted in case the values are negative?


Hi @gordansket

How about a map function? Something like this:

import "internal/debug"
// your Flux query ///
|> map(fn: (r) => ({ r with _value: if r._value < 0.0 then debug.null(type: "int") else r._value }))