Plot multiple graphs in one panel for influxdb datasource

I want to use multi-value templating variable and plot multiple lines using “Graph” panel of grafana, depending on the number of values selected by the user.

currently, my query is

select result from measurement where qm =~ /$qm/

Above $qm is the templating variable. Above query adds datapoints but shows single line on the graph.
I want to show multiple lines, each line for every selected qm value in template variable.

Any updates on this one. I am facing the same issue with an Elasticsearch datasource.