# Process and plot multiple variables from MYSQL within Grafana

**URL:** <https://community.grafana.com/t/process-and-plot-multiple-variables-from-mysql-within-grafana/37572>\
**Category:** MySQL\
**Tags:** mysql\
**Created:** [October 6, 2020, 3:07pm UTC](https://community.grafana.com/t/process-and-plot-multiple-variables-from-mysql-within-grafana/37572 "2020-10-06T15:07:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamishkerr](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@hamishkerr](https://community.grafana.com/u/hamishkerr)\
**Post date:** [October 6, 2020, 3:07pm UTC](https://community.grafana.com/t/process-and-plot-multiple-variables-from-mysql-within-grafana/37572/1 "2020-10-06T15:07:35Z")

</div>

Hello.  
I am using MySQL as my data source. I have to plot the change in X with respect to time over my selected time period, where X = (Y^2 + Z^2)^0.5.  
If possible, I would like to have Y and Z as variables in my dashboard rather than calculating X directly in a MySQL. From what I understand, I need to create two separate variables for Y and Z associated to my dashboard, and then reference them in my query when plotting in my panel.  
I can create variables Y and Z which each contain a series of variables for the time period I have selected, but then I don’t know how to plot them, mainly because I do not understand:

- where I get the time variable from
- how Grafana knows what the time variable is to assign to X.

Do I have to extract the time inside the variable queries and call it something specific? OR create a specific time variable and reference that in my plot query?

Here are some example SQL statements which would be entered into my dashboard variable:  
SELECT Y as “Y” from my\_database;  
SELECT Z as “Z” from my\_database;

Thank you very much in advance
