Multi value variable for timeseries

Hello

I’m struggling to use multi-value variable and then use them in timeseries panel. I’m using Grafana 12.4.3.

I have 2 variables, alias and tag_selection, the user can select select multiple alias to get multiple tag_selection. Here are my variable definition:

image

Both are allowed with Multi-value. When I select 2 Alias, I get 2 tag_selection in the preview of the variable:

So perfect now I know I can use multiple value for tag_selection. Unfortunately I am not able to use them after that even in a basic text panel (I want timeseries at the end but I’m first trying to make it work in Text panel).

Here is my text panel :

According to the preview of the variable I should have for Tag_selection a second tag PROPULSION_STBD_MOTOR_POWER, and I don’t understand why it’s not the case…

Thanks for your help

It works for me:

Try never Grafana version.

Just upgraded Grafana to 13.2.0. Same issue…

The preview of the variable is showing 2 values. But in panel it shows only one…

Weird…

What’s your datasource? Can you replicate it on https://play.grafana.org ?

I’m struggling connecting to play.grafana.org, I’m not sure to have an account…

But the database is really simple, it can be summarize in a simple csv file like this one (I’m not allowed to share a csv file only a picture of it)

What is datasource type, oks? It looks like some SQL: Redshift, PostreSQL, MySQL, …?

sorry, PostgreSQL

Print whole query used in tag_selection to text box and check if it is correct.

This looks like a Grafana regression with multi value chained variables.

Your tag_selection query is already correct:

sql

SELECT tag_name
FROM tag_name_and_alias
WHERE alias IN (${alias:sqlstring})

The fact that the variable preview contains both tag values confirms that the query is returning both options. The problem is that when the dependent tag_selection variable is used in the panel, only one value is being interpolated.

This matches Grafana issue #130511, where a multi value parent variable and multi value chained variable result in only one value being passed to the linked variable:

So changing IN/= or the PostgreSQL query is not the fix here → your variable query is already using the correct syntax.

For a PostgreSQL panel, the normal syntax for the multi-value variable would be:

sql

WHERE tag_name IN ($tag_selection)

but if $tag_selection itself is losing the second selected value, that query cannot fix the underlying problem.

Hello @jangaraj and @infofcc3 , sorry I left for few holidays, thank you for your answers.

It looks like a Grafana issue that can’t be solved without a fix. I’ll have to do it differently (or no do it at all) until this is fixed…

Nicolas

The key thing to check is how the multi-value variable is being interpolated. Grafana may return multiple values as a formatted string rather than exposing them as separate values in a Text panel. Try ${tag_selection:csv} or ${tag_selection:pipe} depending on how you need to use the values. For the Time series query, the correct format can also depend on the data source. If the variable preview shows both values, the variable itself is likely working and the issue is the interpolation/query syntax.

Hello,

Thanks for insights. Unfortunately I mooved to a different approach using Business variable. It’s working fine like that.

I’ll remember your recommendation if I have to do this job again.