How to use a variable to apply a certain time range?

  • What Grafana version and what operating system are you using?
    Docker Container with Grafana v9.2.0 + InfluxDB v 1.8.9

  • What are you trying to achieve?
    I have several statistics which I would like to display on a monthly base. While I can adjust an absolut time range to display a certain month, this is very inconvenient when I want to quickly cycle through several months as I always need to select the correct time range in the date picker. As my dashboard only makes sense for displaying values of a whole month, I thought about adding a variable which would allow me to set the time range

  • How are you trying to achieve it?
    So far I tried to add a variable but I was unable to get it working. I thought about something like this: (translation: Selector “Month” allows to select a certain month, like January)
    image

  • What happened?
    It seems to be impossible to use variables like month and year to make the dashboard display values of a certain time range. I thought about embedding the variable’s content in my flux statement, but unfortunately also the range function of flux does not accept such values

  • What did you expect to happen?
    I would like to have an easy way to switch between different months in my dashboard, ideally with an additional year selector

2 Likes

Hello @percy2live

I think a similar feature has already been requested here. You might want to share your scenario so it has a chance to be part of the project.