Call a Grafana variable within ""

Hey,

I have a cutomized Grafana variable which returns a 1;2;3 or 4
I tried to call it within my Filters like this:

Variable="${myVariable}"

from(bucket: “MyBucket”)

|> range(start: v.timeRangeStart, stop: v.timeRangeStop)

|> filter(fn: (r) =>

r._measurement == "MyMeasurement" and

r.Generic_Name == "Machine_**{Variable}**_weight"

)

The Problem is that i only get no data.
Is there a way to achive this?

I tried to call the Variable like in this post

I found a possibility which works with the filter() function and the keep() function.

That is to put the text pieces together like this:

r.Generic_Name == “Machine_”+"${Variable}"+"_weight"

However this doesn’t work with the rename() function. i only get the error:
image

Why is my way working on some functions but not with rename?
What do i have to do to make it work?