Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable as field name

Hi,

I have the following steps to calculate the total value depending on a currency selection button:

1) A button to select  between Local Currency/ Euro. The selection is kept in a variable vCurrency (Values can be LC or EUR)

2) A variable: vCurrencyField to select either the field of LC [Amount LC] or the field with EUR calculations [Amount EUR]. The formula I am using is: =if((vCurrency)='EUR','[Amount EUR]','[Amount LC]')

3) I want to use vCurrencyField in another variable vAmount : sum({<Year={$(vCurrent_Year)},Type={$(vType)}>}$(vCurrencyField))

Unfortunately this does not work. Am I missing any $ or = signs? or what could be the problem?

Best regards,

AD

Labels (1)
2 Replies
m_woolf
Master II
Master II

2) Field names don't include the square brackets.

JonnyPoole
Former Employee
Former Employee

i think #2 is wrong too... lose the single quotes


=if((vCurrency)='EUR',[Amount EUR],[Amount LC])


OR #2 is right and you can lose the $() on the vCurrencyField in #3


sum({<Year={$(vCurrent_Year)},Type={$(vType)}>}  vCurrencyField )