Weird query behaviour with different time ranges

Due to a wront retention setting I’ve lost a whole month of data.
As I have the data in another system, I’ve used the “Load Data” → “Line Protocol” → “Write Data” functionality in order to write the data points.
The original data thats left starts at the 9th of December 2022.
I’ve tried to fill the time before that beginning on the 6th of November.

Now, when I query the data points with the Data Explorer and I select the date range from 01.11.2022 to todays date (20.01.2023) I only see the added datapoints that have been lost before.

When I execute the same query, but instead of a custom time range, I set past 30d, I do see the data from the 21st December until today.

How come, that with one time range I see the original data and with another time range i only see the manualle added data points?

Please check your data with the view raw data option. I think this may be happening due to some tag addition you are seeing weird behavior or you can try to pass the time range statically in the query itself and check the behavior.

Please paste your query in the comments so people can help more.

The query is exactly the same, either if I query with “Past 30d” selected, or with “custom time range” selected (01.11.2022 - 24.01.2023):

from(bucket: "XX")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "XXXXXXXXXX")
  |> filter(fn: (r) => r["_field"] == "pvpowerout")
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")

The datapoints in the “View Raw Data” are similar to the two graphics that I showed in my first post.

View Raw Data with “Past 30d”

View Raw Data with “custom time range” selected (01.11.2022 - 24.01.2023)

View Raw Data with custom time range in the query

Nyone with an idea about how to fix this?

Hello @codac,
Try removing the aggregateWindow() function.
Does that help?
You can delete it or comment it out with // or cmd + /

Hello @Anaisdg , thank you for your reply.
Unfortunately it doesn’t help.