Hello,
I am working with big data set in InfluxDB and need help with a query. I have a dataset where values remain constant for a period of time and then change. I want to filter the data to only return data with the timestamps where the value changes from the previous record.
Here’s an example of my dataset:
time value
2024-11-01T00:00:00Z 1
2024-11-01T01:00:00Z 1
2024-11-01T02:00:00Z 1
2024-11-01T03:00:00Z 1
2024-11-01T04:00:00Z 1
2024-11-01T05:00:00Z 5
2024-11-01T06:00:00Z 5
2024-11-01T07:00:00Z 5
2024-11-01T08:00:00Z 5
2024-11-01T09:00:00Z 5
2024-11-01T10:00:00Z 3
2024-11-01T11:00:00Z 3
2024-11-01T12:00:00Z 3
2024-11-01T13:00:00Z 3
2024-11-01T14:00:00Z 3
2024-11-01T15:00:00Z 3
2024-11-01T16:00:00Z 1
2024-11-01T17:00:00Z 1
2024-11-01T18:00:00Z 1
2024-11-01T19:00:00Z 1
Desired output:
time value
2024-11-01T00:00:00Z 1
2024-11-01T05:00:00Z 5
2024-11-01T10:00:00Z 3
2024-11-01T16:00:00Z 1
I have tried using the stateChangesOnly()
function, but it only seems to work for predefined states like ok
, warn
, or crit
.
Is there another function or method in Flux to achieve this for custom numerical values? Any advice or guidance would be greatly appreciated.
Thank you, have a nice day!