Unable to Make Math Expression Work Using Variable Templates

Grafana version: * Grafana v8.2.7 (d2cccfe91e), self-hosted Grafana Under Linux OS. Data Source Elastic Search Version > 7.x

Issue:
Under variable templates I am able to pass variables to 2 Queries without any problem and Grafana renders the time series as intended. When I want to do a math operation under expressions between the results of Query A and Query B I am getting results. But I get not results if I group each query by the same variable. I do not see any errors.
An example of math expression 100*($A/$B). . A=Query A. B=Query B. A and B are numerical values.
Any idea?
is this is supported? Or
is there any trick to make it work?
I tried multiple ways without success.
Your guidance will be appreciated.

Thanks
Lp

not sure this is supported. server side expressions are still quite beta and transformations seem much more popular:

Thanks for the hint Mattabrams!
Server side expressions work fine except when results are aggregated by @timestamp plus one or more than one variable template.
I have not uses transforms to do math operations between the results of 2 queries. Not sure if transforms can do this.

Same issue with transforms.

Using transforms is another solution that works but it does not support dynamic variables passed to the aggregation group by. To make it work you have to hardwire each result in the transform. It defeats the purpose of variables and dynamic dashboards.
I would prefer expressions if it works under the scenario I need. It is straight forward and you can add any query results…
I will be great if this improvement is implemented. Not sure if this issue was addressed in the newer versions of Grafana.

Thanks!

1 Like

My understanding is that server-side expressions are still under active development: