Moving Average: Incorrect Starting Timestamp?

Hey Team,

I’m using

DB: InfluxDB 2.7
Language: InfluxQL

I expect the first datapoint returned by the below query to have a timestamp of 2023-08-30T15:09:00Z but for some reason it returns the first datapoint with the timestamp as 2023-08-30T15:08:00Z, any idea why?

SELECT MOVING_AVERAGE(MEAN(quantity),10) AS "quantity" FROM "quantity_management".."group-products" WHERE ("product_id" = 'YAZOO') AND time >= '2023-08-30T15:00:00Z' AND "time" <= '2023-08-31T16:00:00Z' GROUP BY "product_name","product_id", time(1m)

cc: @scott , @Jay_Clifford , @Anaisdg for advice please :pray:

Hey Team, pinging here in case you clarify please :pray:

cc: @scott, @Anaisdg, @Jay_Clifford

@ajetsharwin In InfluxQL, when you group by time(), the resulting timestamp of the aggregate function uses the left-bound (start time) of the group (window). These windows are predefined. Here’s an explanation in the InfluxQL docs: GROUP BY clause | InfluxDB Cloud Serverless Documentation