Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
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
Highlighted
Partner
Partner

Hi!

Use

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

in your expression.

regards,

Jaime.

Highlighted
Contributor II
Contributor II

hi thank you but it doesn't  work ! 

Highlighted
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.

Highlighted
Contributor II
Contributor II

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

Highlighted
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.