Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding a variable as part of an exporession

Hi All,

I'm trying to use a variable as part of field name in an expression but not having much luck:

So, my list box(can only select single item) is:

Year1

Year2

Year3

And my expression:

=Sum(YearlyPerf.$)

where $ is either a the variable extracted from the listbox. e.g. YearlyPerf.Year1

Any ideas?

Jamie

2 Replies
Not applicable
Author

Do you already have a variable which is returning the proper selection?

If so, you should use:

Sum($(vVariable))


Not applicable
Author

Hi Jamie,

Firstly create a variable vYr then add an input box and select vYr on the constraints tab select predefined values in a dropdown box then tick listed values. Add Year1;Year2;Year3 This is exactly what the field is called.

Your expression should be =Sum(YearlyPerf.$(vYr))

The $ expansion should then put in the fully qualified field and work in the expression.

Regards,

Neil