Confusing respone to aggregate-query (daily min, max, etc.)

Hey there! :slight_smile:
I’m new to InfluxDB (Ver 2.7) and cannot find a solution for the following behaviour:
I do collect temperature-measurements from a sensor (a few hundred readings per day) and want to calculate the min, max, etc.
To achieve this I created the following query:

from(bucket: "climate")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "temperature_sensor")
  |> filter(fn: (r) => r["_field"] == "value")
  |> aggregateWindow(every: 1d, fn: max, createEmpty: false)
  |> yield(name: "max")

Setting the custom time-range in the Data Explorer to
2023-04-09 00:00:00 to 2023-04-09 23:59:59
I get a response (table) with two (??!) entries:

I would expect only ONE. So why am I getting two? … or: why do I get the first line with _time = 2023-04-09 02:00:00 GMT+2 ?

Messing around I tried to change the time range, the aggregate-period (1d, 24 h, 23 h, 25 h,…)… but the result stays (more or less) the same.

What am I doing wrong? How can I change my query to get only one (the right) result?

Thanks a lot!
HeS

Hello @Hesindian,
AggregateWindow function doesnt actually aggregate from the start date.
Please see

I hope it makes sense what’s happening now!

However if you just want the min, max, etc I recommend using those functions instead of aggregateWindow

data = from(bucket: "climate")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "temperature_sensor")
  |> filter(fn: (r) => r["_field"] == "value")

data |> max() 
  |> yield(name: "max")

data |> min() 
  |> yield(name: "min")

Hello @Anaisdg,
Thanks a lot!! :pray:
This explains the behaviour. Didn’t know, that I could use a max()-function without aggregate! I was already wondering… and did search the knowledge base / documentation… but missed this info.
Neither I found the Info about the epoch-time stuff. Perhaps it would be a good idea to put a short hint in the aggregateWindow documentation (aggregateWindow() function | Flux 0.x Documentation).

Best
HeS