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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problems getting set analysis working correctly with variable?

Hello,

I have some problem getting a set analysis expression to work when using a variable.

My expression looks like this:

sum({$<Product={$(vProduct)}>} Output)

and the variable can take on two different values, W12V32 and 9R32.

If the variable takes on value W12V32 the expression above works fine, however if the variable takes on the value 9R32 it does not work.

However, the expression works fine if i hardcode it like this:

sum({$<Product={'9R32'}>} Output)

Unfortunately this is not an option for me.

So what could be the problem?

v.10 SR4

2 Replies
swuehl
MVP
MVP

You can try embedding your variable expansion into single quotes:

sum({$<Product={'$(vProduct)'}>} Output)

And check if the dollar sign expansion returns the result you expect (e.g. by not setting a label for the expression, so you get the expanded expression shown in your chart as label).

Not applicable
Author

Thanks swuehl,

I checked the label and it said:

sum({$<Product={9R32}>} Output)

I changed the variable so that it took on the value of '" 9R32 "' (i.e. both single and double quotes, double on the inside).

The label then changed to

sum({$<Product={"9R32"}>} Output)

and the expression started working.

I also tried using two single quotes (i.e. ''9R32'') but that did not work. Well newermind, main thing is that it works (Just thought that it would have been more coherent).

Thanks!