Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Evaluating a variable as a field name

Hi,

Another Newbie Question.

I am trying to build up an expression to use a variable to select a field for a graph axis.  (I previously did this using a separate inline table to make the selection but the performance was not good.)

To start with, I have set the variable in the load script thus:

SET vMasking = 'Masked Mean Packet Delay (ms)';

Then I want the graph to select its axis based on the value of the variable, so I want the graph to be the:

Avg[Masked Mean Packet Delay (ms)]

But I want it to take the value from the variable, so I can change that later

I've tried Avg($(vMasking)) among other things, which doesn't work.

Thanks

1 Solution

Accepted Solutions
MVP
MVP

Re: Evaluating a variable as a field name

Actually this:

Avg($(='[' & vMasking & ']'))

UPDATE: Also change the set statement to this (remove the single quotes)

SET vMasking = Masked Mean Packet Delay (ms);


UPDATE2: Sample attached

2 Replies
MVP
MVP

Re: Evaluating a variable as a field name

Actually this:

Avg($(='[' & vMasking & ']'))

UPDATE: Also change the set statement to this (remove the single quotes)

SET vMasking = Masked Mean Packet Delay (ms);


UPDATE2: Sample attached

Not applicable

Re: Evaluating a variable as a field name

Works perfectly thanks!