Window function result grouped by 'period' limit

Hi,

How can I specify a specific range for time windows without rounding the window span to ‘period’?

I am trying to group a range of time together so that I can have ‘buckets’ of time and do the average on the value. Seems simple enough considering the flux ‘window’ functions.

Although, I can’t seem to achieve it. It seems using the window function groups the time in boundaries specified by period.

Example:

from(bucket:“telegraf/autogen”)
|> range(start: 2020-07-17T00:30:30.349Z, stop:2020-07-17T00:35:30.800Z)
|> window(period:2m)

will create multiple window. (data snippet for clarity)

table 1
_start                                                  _stop
2020-07-17T00:30:30.349000000Z  2020-07-17T00:32:00.000000000Z
table 2
_start                                                  _stop
2020-07-17T00:32:00.000000000Z  2020-07-17T00:34:00.000000000Z
table 3
_start                                                  _stop
2020-07-17T00:34:00.000000000Z  2020-07-17T00:35:30.800000000Z

I am surprised that the first window has been ‘cut’ at the 2 minutes mark:
2020-07-17T00:30:30.349000000Z -> 2020-07-17T00:32:00.000000000Z.
This is not a full 2minutes.

I would like to have the windows to contains a full 2 minutes from the start. Here is an example of what I wish for:

table 1
_start                                                  _stop
2020-07-17T00:30:30.349000000Z   2020-07-17T00:32:30.349000000Z
table 2
_start                                                  _stop
 2020-07-17T00:32:30.349000000Z   2020-07-17T00:34:30.349000000Z
table 3
_start                                                  _stop
 2020-07-17T00:34:30.349000000Z  2020-07-17T00:35:30.800000000Z

Compare the first table of the actual result with what I want to see the difference.

How can I achieve this? Am I using the correct approach. Any input is welcome.
Thank you

Hello @JFL,
Can you please try converting the window to second or nanosecond precision?

window(period:120s)
window(period: 120000000000ns) 

Thank you