Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
seif
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
jaibau1993
Partner - Creator III
Partner - Creator III

Hi!

Use

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

in your expression.

regards,

Jaime.

seif
Contributor II
Contributor II
Author

hi thank you but it doesn't  work ! 

jaibau1993
Partner - Creator III
Partner - Creator III

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.

seif
Contributor II
Contributor II
Author

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

jaibau1993
Partner - Creator III
Partner - Creator III

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.