Data operations on a group of data

Does InfluxDB allow for data operations on a group of data (for example the InfluxQL GROUP BY) and to place the results in sample n and not in the middle of the time range for the group? For example: tn, tn-1, tn-2, tn-3, tn-4, tn-5. I want to be able to place, for example, a mean value to be displayed at tn and not tn-3. This looks like a bug to us and we need the data to fall on tn. For example, mean(“myFieldKey”) GROUP BY 5sec. It may be by design, and it wouldn’t meet our needs.

Hey @chris.churilo,
I do believe that this is possible with InfluxQL. You can use an offset interval which is a duration literal:
https://docs.influxdata.com/influxdb/v1.8/query_language/explore-data/#advanced-group-by-time-syntax

However, it’s worth mentioning that it’s also possible with Flux. You can use the timeShift() function:
https://docs.influxdata.com/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/timeshift/

One of the big advantages of Flux over InfluxQL is that there are more ways that you can manipulate timestamps:
https://docs.influxdata.com/influxdb/cloud/query-data/flux/manipulate-timestamps/