I need to get in columns the average maximum value between two rows with n steps. If the step is 6 (n = 6), I need to find out the average maximum value between 1 and 6 (not inclusive) rows, then between 6 and 12 (not inclusive), and so on. Both the step and the count of rows can be different.
|id|eventDate | x | y |
-------------------------
|1 |10.10.2021| 0.33|0.4|
-------------------------
|2 |10.11.2021| 0.34|0.5|
-------------------------
|3 |10.12.2021| 0.35|0.6|
-------------------------
|4 |10.13.2021| 0.36|0.7|
-------------------------
|5 |10.14.2021| 0.37|0.8|
-------------------------
Step = 3 (n = 3) The result should be
|id|eventDate | x | y |
--------------------------------------------------------------
|3 |10.12.2021| avr between id 1 and 3|avr between id 1 and 3|
--------------------------------------------------------------
|5 |10.14.2021| avr between id 3 and 5|avr between id 3 and 5|
--------------------------------------------------------------