Iteration between rows

Hello community,
I am trying to find the last low “pivot” point in a time series table using Flux. By low “pivot” point I mean the data point that is lower than its three previous data points and three next data points (time wise). I want to identify the last low “pivot” point and retrieve its value as well as its timestamp from the table.

I have tried using the reduce() function along with filter() and map() functions, but I am facing issues with the array operations such as slice() and min(), as they are not available in Flux.

Can you please help me with an example query or suggest an alternative approach to achieve this low “pivot” point identification using Flux?

My table looks like this and there is no “na” value:
_time | _value
2023-03-07 18:00:00 | 14.1
2023-03-07 19:00:00 | 28.7
2023-03-07 20:00:00 | 42.7
2023-03-07 21:00:00 | 56.8

Thank you in advance!

I did not understood what do you need. I got confused, however there are a functions to get the top n values and the bottom n values

One second thought if your data points are each hour, and you want the minimun value between 3 data points before and 3 datapoints after what if :

|> aggregateWindow(every: 7h, fn: min)

Hi fercasjr.

Sorry for the confusion, let me explain again by giving an example.
Let’s say that we have the table bellow:

_time _value
2023-03-07 18:00:00 14.1
2023-03-07 19:00:00 28.7
2023-03-07 20:00:00 42.7
2023-03-07 21:00:00 56.8
2023-03-07 22:00:00 54.3
2023-03-07 23:00:00 52.5
2023-03-08 00:00:00 49.8
2023-03-08 01:00:00 50.2
2023-03-08 02:00:00 51.3
2023-03-08 03:00:00 54.6

I need to create a query that will return only the last point where the condition occurs:

_time _value
2023-03-08 00:00:00 49.8

I am basically trying to get the peak value of the series.