Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Do More with Qlik - for Beginners and Beyond, Topic: Qlik Replicate on January 21, 2PM EST. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

how to call a dynamic variable name

I have field  named  "num" that contains a number from 1 to 5 and I have variables named v_1, v_2 ,,,, v_5 that contain set analysis.
I want to call these variables automatically in a tab according to the fields. 
$ = '(v _' & num & ')'?

 

Im looking if i can do that without using if statement ?

 

thank you 

5 Replies
Partner
Partner

Hi!

Use

$(='v_' & Only(num))

in your expression.

regards,

Jaime.

Contributor II
Contributor II

hi thank you but it doesn't  work ! 

Partner
Partner

Hi

How are you using your variable and where? Note that the expression I provided works only if there is one and only one "num" selected.

I attach a sample file where you can see that it indeed works.

Regards,

Jaime.

Contributor II
Contributor II

I use the variable in a table as a measure variable.PNG

Partner
Partner

Hi again!

My bad, I didnt remember that you needed it a chart in order to modify set expression. Use something similar to

=Sum( $($(='v_' & Only(Num))) Amount)

I attach an APP so you can see how I built it.

Regards,

Jaime.