Show values but only when difference between two consecutive values not bigger than

Hello,

How to filter data but only with difference between two consecutive values not bigger than…?
I thought about “difference” function but I don’t know how to utilize it in the code.

This is my query:

from(bucket: “home_assistant/autogen”)
|> range(start: v.timeRangeStart, stop:v.timeRangeStop)
|> filter(fn: (r) =>
r._measurement == “°C” and
r.entity_id == “v_temperatura_na_zewnatrz” and
r._field == “value”
)

welcome to the :grafana: forum, @tomeks13

are you talking about this?

for strict influx query questions, you might get a faster answer on the influx community forum:

I am stuck in same problem
difference() isnt enough for me, I need something like display records only when difference is >= x
Did you figure it out OP?

If one is trying to display records only when the difference between two consecutive values is > 200, then I believe the Flux query would contain the following:

|> difference()
|> filter(fn: (r) => r._value < 200)