Have stat panels use the average for percent change instead of first vs. last values

  • What Grafana version and what operating system are you using?
    12.0.0 on Debian

  • What are you trying to achieve?
    Stat panels have an option for “show percent change.” From what I can tell, it looks like Grafana calculates the percent change as the relative difference in the most recent value from the oldest value. That doesn’t work for my use case: I’d rather see the percent change as the relative difference in the latest value from the average value in the sample set.

    As an overly simplified example, consider a stat panel with 100 values where the first value is 1, the last is 101, and all the others are 100. Right now the percent change is astronomically high because 101 (the latest value) is massively higher than 1 (the first). I’d rather see a ~1% difference because the average is about 100 and the latest value is only slightly higher at 101.

  • How are you trying to achieve it?
    I enabled “show percent change” but I don’t see any means to choose how it’s calculated, only its presentation (color, etc.).

  • What happened?
    Grafana only shows the percent change as the relative difference between the first and latest values.

  • What did you expect to happen?
    Probably that, but it’s not what I want to happen.

  • Can you copy/paste the configuration(s) that you are having problems with?
    n/a, although for context the data source is a MySQL query.

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

  • Did you follow any online instructions? If so, what is the URL?
    I can’t find something similar.

Hi, I don’t think it’s possible right now. You can always create a second stat that would point to that difference, but I guess it’s far from ideal. You could create an issue on github, maybe with enough likes it will get implemented :smiley: