How to duplicate query in grafana based on multi-value variable

How can I duplicate query in grafana based on multi-value variable?
I am using PostGreSQL data source. I would like to generate multiple timeseries chart(s) on the same panel.
For Ex. I have a variable varName which has values var_1, var_2, var_3, …var_n
I need to get the series for all the VarName values (Note: Values in the varName varies. It is not fixed. It would keep increasing)
Hence I would need the queries to be duplicated for varNm in varName : series value would be ‘select data from test table where name=varNm’

Is there any suggestion(s)?

It is really surprising to see that I haven’t received any response/solution yet from this community support?
Is it that this feature is not supported? or there are no workaround or solutions to this?

I don’t find it surprising. I think you’re trying to do something which most
people have no experience of attempting to do, and may even not be possible to
do, therefore there is no solution to your requirement.

Bear in mind that this is a community support list (although some of the
developers do answer here too), therefore most people can only speak from what
they have needed to do in their own setups, and do not know the detailed
internal capabilities of the Grafana system.

Personally I think the fact that you do not know where your varName series
will end means it is not possible to come up with a query which does what you
want, however I haven’t spent time trying to solve a problem like this for my
own needs, so there may be a way to do it.

Best wishes,


Thanks @pooh for your response!
When you say “there may be a way to do it” do you know any workaround as such for this?

I think there could be 2 ways in which this issue can be resolved,
If we have option to duplicate query based on multi-value variable then this issue can be resolved.
I do not see this option in grafana query editor yet?
Is there any other option to duplicate the query?

If we can some how iterate over the multi-value variable through some query language identified/supported by grafana in the query editor and then form the query based on variable value.

Anyone, any idea on any of the above options?

One Question: How can I get variable display name in the query?

Any quick help or input by the community users would be highly appreciated.