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.

Maybe my line protocol is wrong?!

ABCDEFGHIJ pvenergytoday=1.3 1669459511
_measurement is ABCDEFGHIJ
_field is pvenergytoday
_field value is 1.3
unix timestamp is 1669459511 (set as precision seconds)

@Anaisdg and @Ravikant_Gautam can you please continue to help me on this issue?