How to to plot in a graph values from two different fields selected by a multi value variable

I have a SqlServer data with the following fields:

Time | Variable1 | Variable2 | Variable3

The VariableX data si numeric.

I’d like to create a Grafana custom Variable with values Variable1, Variable 2, Variable3 with multi selection enabled so to plot a graph with one or two or the three different values.
How to do this?
To plot different vales on the same plot I think the only way is to have different queries A, B, etc with divverent value fields, and I don’t know how to split the resulting variable value when I have multi selection enabled.
Is there a format option selecting only single multi variable items?
Thanks.

Hi matteodt,

you can use your multivalue variable in select statement like this:
SELECT $__time(mydate), ${mymultivaluevar:csv} FROM ....
see: https://grafana.com/docs/grafana/latest/datasources/mssql/#using-variables-in-queries

grassu

1 Like