Doubts about aggregateWindow

I don’t know how to get the date 27。 Here is my search statement

import “timezone”
from(bucket: “my-bucket”)
|> range(start: 1649606400, stop: 1657555199)
|> filter(fn: (r) => r[“_measurement”] == “abnormalinfo”)
|> filter(fn: (r) => r[“_field”] == “system_version”)
|> filter(fn: (r) => r[“devicetypesid”] == “10005”)
|> group(columns: [“devicename”], mode:“by”)
|> aggregateWindow(every: 30d, fn: count, timeSrc:“_start”, location: timezone.location(name: “Asia/Shanghai”),createEmpty: false)
|> group(columns: [“_time”], mode:“by”)
|> sum(column: “_value”)
|> aggregateWindow(every: 30d, timeSrc:“_start”, location: timezone.location(name: “Asia/Shanghai”), fn: first,createEmpty: true)
|> sum(column: “_value”)

This is my search result:

Hello @entre,
Are you trying to aggWiniodw() over month periods? Some months have 31 days. I’d try using

|> aggregateWindow(every: 1mo, timeSrc:“_start”, location: timezone.location(name: “Asia/Shanghai”), fn: first,createEmpty: true)

Is that what you’re asking I couldn’t quite tell.
PS what are you using InfluxDB for? I’m curious to learn about the projects that community members are working on.

I then use influxdb to aggregate and count the number of states of some devices for a certain period of time. These time periods are uncertain, such as 3days, 7days, 20 days, 30 days, 45 days, etc.
I checked the documentation and found that when my time is 7 days, it starts from Thursday. I can use 0ffset to adjust the start time. When I think it should not be like this, when every is 1week, it can start on Thursday. Yes, when using 7d it should be better to aggregate by the original time.

I am engaged in an industry related to the Internet of Things, mainly doing equipment management and analysis

Hello @entre,
Did you still have a question?