UPDATE $__timeFilter variable

Hi everyone, hope you’re doing well.

-I’m on debian and using v10.0 Grafana

  • I want to update the value of the date Picker selected by the user for one panel to get on my dashboard a panel with the previous informations of a working period.
    For example, if this date is selected :
    image
    I want to search in my database for this date with a -8 hour interval.

-I tried to modify directly the value of the timeFilter variable with SQL but i doesn’t work:
Unmodified timeFilter =>
image
And i try to achieve this =>
image

Thanks for helping :slight_smile:


try this

SELECT
  employee_name,
  Time_Stamp,
  activity
FROM working_logs
WHERE Time_Stamp BETWEEN
  TO_TIMESTAMP($__from / 1000) + INTERVAL '8 hour'
  AND
  TO_TIMESTAMP($__to / 1000) + INTERVAL '8 hour'

For past 8 hour

Thank you so much for this MySQL solution.
I have founded another solution with the QueryOptions, setting the parameter ‘Time shift’ :sweat_smile:

Thank you guys

1 Like