Key/value select variable / influx db

Grafana 8.3.4

Hello, is there anyone who can help me, I just can’t get any further…

For example, I have 10 very long data points in an Influx DB that all show me the electricity meter readings of different objects.

0_userdata.0.tnn.impulse.im.eui-a81758fffe064eec.pulseAbs

I created a custom variable “gasmeter”:

02 Office : 0_userdata.0.tnn.impulse.im.eui-a81758fffe064eec.pulseAbs,05 Andreasberg : hm-rpc.11.REQ0110121.1.GAS_POWER

Now I would like to include the value of the variable in a select:

select non_negative_difference(last(cumulative_sum)) from (select cumulative_sum(non_negative_difference(last(“value”))) from ${gasmeter:value} WHERE $timeFilter GROUP BY time(1h)) WHERE $timeFilter GROUP BY time(1h)

the query without a variable works:

select non_negative_difference(last(cumulative_sum)) from (select cumulative_sum(non_negative_difference(last(“value”))) from “0_userdata.0.tnn.impulse.im.eui-a81758fffe064eec.pulseAbs” WHERE $timeFilter GROUP BY time(1w) ) WHERE $timeFilter GROUP BY time(1w)

Thanks for your help!