Is it possible to set the Dashboard Time Range from a variable?

I have a time range variable that I fetch from InfluxDB. I want that by default, the dashboard should select the time range based on the latest absolute value of this variable.

for ex: In the dashboard , I set a variable using following query
SHOW TAG VALUES WITH KEY = “DtFromRange”

It gives me values similar to this:12/21/21 15:23:49 . Similarly for

SHOW TAG VALUES WITH KEY = “DtToRange”

Now What I want to do is, in the dashboard time range in ‘From’ field I want to apply latest value from DtFromRange and in ‘To’ field latest value from DtToRange. By default always by the latest value of the query since there will be multiple values selected by the query.

Is this possible using Grafana+InfluxDB

If you are trying to interpolate variables into Grafana’s dashboard timepicker, I’m not sure that’s possible.

But you should still explore the full potential of chained variables, which can do all kinds of things (if you’re willing to work for it :laughing: )

Here are some useful starting points and example dashboards in our public sandbox :+1:

I had the need to create a dashboard that sometimes references a specific span of dates (for example, the last full week). What I did was set variables that used queries to calculate the beginning and end dates, then used them as parameters in a link to my dashboard. I displayed that URL on my current dashboard, so if people needed to check on the last full week, they just clicked the URL on the dash