Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

New Contributor III

Re: Difference between $(Variable) and $(=Variable)

Hi you all.

I find interesting what you say here, especially the part in which you say that the second approach makes the expression to be evaluated just once. That suggests we should do it that way, as far as performance is concerned.

I did a little testing. If the $(=variable) will make the variable to be evaluated first and then return its value to the expression, I guessed I would find differences if I do this:

MyVar: sum(Kilos) + sum(Euros)

Then I create a straight table with these two expressions:

Expression 1: $(MyVar) / 100

Expression 2: $(=MyVar) / 100


I would expect different results, since the first one should just expand the content of the variable and hence do something like sum(Kilos) + Sum(Euros) / 100 (for example 10 + 200 / 100 = 12), and the second one should calculate the sum first resulting in something like (10 + 200) / 100 = 2,1.


But the thing is both approaches behave the same way. It seems like both are expanding the content of the variable and doing something like 10 + 200 / 10 = 12. I never get the sum evaluated first.


Please see attached document.