Error: Data outside time range

Hello Community.

I have the following problem:
If I go into a dashboard where the time range is set to “Today” for all panels, I do not see the panel with the info for the previous month: “Data outside time range”

The query is:
import “experimental/date/boundaries”

lastMonth = boundaries.month(month_offset: -1)

from(bucket: “dtu”)
|> range(start: lastMonth.start, stop: lastMonth.stop)
|> filter(fn: (r) => r[“_measurement”] == “mqtt.0.solar.1.0.power”)
|> filter(fn: (r) => r[“_field”] == “value”)
|> aggregateWindow(every: 30m, fn: last, createEmpty: false)
|> yield(name: “last”)

The same panel in another dashboard with the period “Previous month” works without any problems.

What do I have to do to integrate this panel into the correct dashboard (time period: today) so that it also works?

Grafana v11
InfluxDB v2

Specify Time shift in Query options:

Sorry, but this don’t show me the graph.
If i switch to “table view”, i see the right data, but no graph

That’s because panel’s time range to display metric is today - but your query has hardcoded time condition for last month. So metric range “2024-06-01 - 2024-06-30” is of course outside of selected “2024-07-02” panel time range. So don’t hardcode time range in the query |> range(start: lastMonth.start, stop: lastMonth.stop) (use time shift with standard dashboard time range condition)

I guess your response will be “But I must have previous month exactly” - so that’s another topic - search forum for advice: Search results for 'compare with previous month order:latest' - Grafana Labs Community Forums