# Arithmetic on variables?

**URL:** <https://community.grafana.com/t/arithmetic-on-variables/10687>\
**Category:** Grafana Plugin Development\
**Created:** [September 22, 2018, 2:45pm UTC](https://community.grafana.com/t/arithmetic-on-variables/10687 "2018-09-22T14:45:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kempeng](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kempeng](https://community.grafana.com/u/kempeng)\
**Post date:** [September 22, 2018, 2:45pm UTC](https://community.grafana.com/t/arithmetic-on-variables/10687/1 "2018-09-22T14:45:27Z")

</div>

Would it be possible to perform some simple arithmetic operations (addition, multiplication) on variables with a numerical value and use the result as a new variable?

---

<div class="post-metadata">

**Author:** ![restfulblue](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@restfulblue](https://community.grafana.com/u/restfulblue)\
**Post date:** [September 30, 2018, 11:14am UTC](https://community.grafana.com/t/arithmetic-on-variables/10687/2 "2018-09-30T11:14:19Z")

</div>

do you developing you custom plugin?  
for example if we have some sql plugin in use, we can write query like:

select hostname, max(network.send\* $multiplier)  
from  
hardware

after that query variables replaced with variable value, for example

select hostname, max(network.send\* 1024)  
from  
hardware

---

<div class="post-metadata">

**Author:** ![kempeng](https://avatars.discourse-cdn.com/v4/letter/k/b9bd4f/32.png) [@kempeng](https://community.grafana.com/u/kempeng)\
**Post date:** [January 3, 2019, 12:29pm UTC](https://community.grafana.com/t/arithmetic-on-variables/10687/3 "2019-01-03T12:29:11Z")

</div>

I was hoping I would be able to do something like:

$NewVar = $MyVar1 \* $MyVar2

---

<div class="post-metadata">

**Author:** ![musadhk](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/musadhk/32/9689_2.png) [@musadhk](https://community.grafana.com/u/musadhk)\
**Post date:** [February 20, 2020, 12:41am UTC](https://community.grafana.com/t/arithmetic-on-variables/10687/4 "2020-02-20T00:41:00Z")

</div>

@kempeng I have the exact use case. At the moment I manually calculate and then use the result as constant variable. Were you able to find any solution for this?
