Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey everyone!
I have a question regarding a variable in a set expression.
My data structure is as follows: I have one table with KPIs per year per unit.
I have another table for the localisation of the app: It consists of one Expression_Id and a column for each language, f.e.
Expression_ID de-de en-us
Equity ratio Eigenkapitalquote Equity Ratio,
where the Expression_Id equals the English version of the KPI name for the code to be understood much more easily.
Depending on a selection on language, I want QlikSense to show the name of the KPI from the column containing the name in the selected language. F.e. if the selected Language is de-de, QlikSense should show the German name of the KPI identified by the expression_ID from the column de-de.
I have one variable, vLanguage (=Getfieldselections(Language).
To get the KPI name in the desired language, I use the following expression:
Only({$<Expression_ID={Equity ratio}>}$(vLanguage)),
which return only the name of the selected language, but does not address the column in the language table whose name equals the selected language.
Can somebody please advise how to address columns/fields based on variables?
Thanks in advance!
Kathy
May be try this
Only({$<Expression_ID={Equity ratio}>} $(=Language))
Note, I am not using vLanguage (your variable), but Language, you field name... I am assuming that one value will always be selected in this field (either English or German)
Hi Sunny,
thank you so much for your answer. I tried your Suggestion, but it does not work either. The Output is either '-' or the Name of the language (f.e. de-de), depending on my usage of Quotation marks & parentheses...
depends on your usage or Quotation marks and parentheses? Can you elaborate on this?
Hi Sunny,
if I use it as you suggested I get "-", if I put parentheses around I get "de-de", which is the value of my variable. Both are not the desired Output, as I would like to address a field that is named as the variable.
Is there any solution to this?
I find it hard to imagine that no one else has ever addressed a field based on a variable.
Thanks!
A post from another user helped me to address the question. Using set Analysis did not work for me here, but this function:
FieldValue($(vLanguage), FieldIndex('Expression_ID', 'Equity ratio'))