Using time-picker to restrict to/from range for Mean Gauges

Hi everyone,

New to Grafana, so I apologize if there are some things which I do not understand ahead of time. Hoping to get some assistance with figuring out how to incorporate the absolute time picker into a gauge tile. This gauge tile is based on a single CSV.

  • What Grafana version and what operating system are you using?
    Grafana v9.5.2 (cfcea75916)

  • What are you trying to achieve?
    I was asked to look into building a Gauge Visualization which showed the average for a specific time range. The data being supplied to the tile is a CSV import with datetime stamps and numeric values for two different groups. The numeric values are representing percentages, which I am telling Grafana to interpret as %s.

The CSV format looks as follows:

|Date|Group1|Group2|
|1/3/2022|0.87|0.98|
|1/4/2022|0.81|0.94|
|1/5/2022|0.89|0.94|
|1/6/2022|0.94|0.96|
.
.
|5/1/2023|0.74|0.89|
|5/2/2023|0.71|0.87|

I was able to set the tile to display an average of an entire column, but I could not figure out how to get time-picker restrictions to work with the CSV.

  • How are you trying to achieve it?
    I had initially tried using a type conversion for the datetime stamp to have Grafana understand the date format. After realizing this could just be done using todatetime() in a UQL, I switched to doing that instead.
    I then configured the value options so that it calculated the Mean for numeric fields.

  • What happened?
    By selecting different times in the time range picker, I was hoping Grafana would understand to move the floating “to and from” ranges and apply it to the average. But it appears that it does not work this way unlike the time-series tile.

  • What did you expect to happen?
    Average for the two gauges would be made relative to the to and from time ranges supplied by the absolute time range picker.

  • Can you copy/paste the configuration(s) that you are having problems with?
    Unfortunately I can’t provide the exact CSV being provided, but I can mock up one whos format is similar if needed.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    N/A

  • Did you follow any online instructions? If so, what is the URL?
    I read thru this to see if there was any additional fields or functions I could use to possibly supply a ${__to} and ${__from} restriction during the UQL… Maybe there is a way to do it?
    UQL - Grafana Infinity Datasource (sriramajeyam.com)

If any additional info is missing or if images are needed, please let me know. Thanks :slight_smile:

There are ways using uql.
You can find examples in the repo of that plugin