Grafana MSSQL variable problem

I want to have a dashboard with templating. The datasource of the dashboad is MSSQL, also known as TQL and the relevant line in the query is this one:

AND GroupName = ‘FullStack’

So the group name is actually a string in the database.

I know want to define a variable $team, so that the user of the dashboard can choose metrics for a specific team by choosing in the dropdown.

My problem is that I did not managed it to use that variable. I’ve tried things like
AND GroupName = $team /* Error here: No such column FullStack*/
AND GroupName = ‘’’$team’’’ /* Empty result where it should not be empty */

So how can I solve this problem?


Try the query as :

WHERE GroupName IN ($team)

Hi, I’ve tried WHERE GroupName IN ($team) and received this error:
“sql: expected 1 arguments, got 0”

before the query was
WHERE GroupName = ‘somevalue’ and it did work, so it seems that this is not an error in the query itself.

How is your variable defined ?
“GroupName” does have multiple values ?
Do you want to be able to filter on multiple GroupNames ?

The variable has the type “Query” which returns values like:

Currently the multiple values mode is not active, however it could be useful.

Then define your variable as “Multi-value” and use the provided query above.
You should be able to select it also via the dropdown on your panel and see it filtering your graphs.

1 Like

That worked now, thank you very much.