If derivate > 1 store data into bucket

Hello.

I’m trying to create deduplication of data based on value.

data = from(bucket: “IOT”)
|> range(start: v.timeRangeStart, stop:v.timeRangeStop)
|> filter(fn: (r) =>
r._measurement == “opcua” and
r._field == “User2”
)

data
|>derivative(unit: 1s)

With that code I receive the difference between results:

Time, _value;
x, 0
x, 0.1
x, 1

I do need that just when derivate is more or less than 1 stores in a second bucket

Can you help?

Thank you.