Flux query with variable within range()

Dear,

I am trying to display data in a graph panel on the last 24h of a given date (which is not “now”).
I want to start 24h before my v.timeRangeStop.

I tried the following scrip that works well on Data explorer in influxdata Cloud but not in my Grafana query inspector:

import "experimental"
var_start = experimental.subDuration(d: 24h,from: v.timeRangeStop,)
from(bucket: "env_data")
  |> range(start: experimental.subDuration(d: 24h,from: v.timeRangeStop,), stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "co2_daily")
  |> keep(columns: ["_time", "_value", "Lieu"])
  |> yield()

In Grafana, the “start” date is not the good one.
In Influxdata explore, It works well.

Any advice or workaround?

Best Regards,
Antoine

same problem here… don’t know how to replace the time variable

v.timeRangeStop

so that it works with Grafan’s time pricker