Panel that calculates the percentage difference in values between two other panels

Hi everyone!

  • What Grafana version and what operating system are you using?
    Grafana 8.3.3 with Prometheus 2.32.1 on Kubernetes.

  • What are you trying to achieve?
    I’m trying to create a panel in Grafana that calculates the percentage difference in the value of two other panels. However, those two panels reference completely different time ranges, which are overridden using query options, so I can’t reuse the PromQL queries directly.

  • How are you trying to achieve it?
    I can see that Grafana allows the use of another panel as a data source, but it doesn’t seem to expose a way to actually perform any calculations on the referenced data. There also doesn’t seem to be a way to specify multiple time ranges for a single panel.

Is there a way to achieve what I’m trying to implement here?

Apologies if my explanation isn’t great, I’m relatively new to Grafana and am still finding my way around the terminology.