In QlikView, as well as in Qlik Sense, there are numerous places where you can enter texts or expressions: In text objects, as measures in charts, as labels of objects, in variables, etc. If you start the text with an equals sign, this tells QlikView that “here comes a formula”. So, QlikView evaluates the string and calculates the expression instead of just treating is a text constant.

 

Sometimes you must to use an equals sign, and sometimes not. But how can you know whether you must use an equals sign or not?

 

Basically, QlikView can interpret the text in two ways; either as a text (i.e. as a value) or as an expression. And what QlikView does by default varies from place to place.

 

In a chart measure (the expression), the text is interpreted as an expression. This means that you do not need an initial equals sign. It is OK to enter one anyway – it will not change the interpretation. This is an assignment by expression. This means that the value will be recalculated every time the user clicks. If you instead want to show the text as text, and not evaluate it, you need to enclose it in single quotes. There are many places in QlikView that behave this way: Measures, background colors, show conditions, calculation conditions, etc.

 

 

Image4.png

 

 

This is very different from e.g. QlikView Text boxes. Here, the text is interpreted as text. This is an assignment by value. This means that if you write an expression, it will not be evaluated unless it starts with an equals sign. Many places in QlikView behave this way: Text boxes, labels, Set statements, dollar expansions, etc. All places where it makes sense to use a plain text or a simple value behave this way.

 

 

Image6.png

 

 

Variables need a couple of extra words. Normally, you assign a variable by value; either in the script using a Set or Let statement, or in the user interface through an Input box or in document properties (Variables sheet).

 

 

Image7.png

 

 

An alternative is to use an assignment by expression. Then the value of the variable will be recalculated every time the user clicks, before it is used in other formulas. Just make sure that the little equals sign is there, and it will work.

 

 

Image8.png

 

 

Dollar expansions use exactly the same logic. If you have a dollar expansion without an equals sign, the enclosed text will be read as-is and used as a variable name. But if you instead use an equals sign, the enclosed text will be evaluated before it is expanded.

 

For example, assume that the variable vEndYear has the value of ‘2014’. Then

     $(vEndYear) will be expanded as ‘2014’

whereas

     $(=vEndYear-1) will be expanded as ‘2013’

 

Finally, a small word of warning: The initial equals sign means an extra calculation every time the user clicks. And every small calculation uses some CPU time and carries a small performance penalty. Hence, you should not use too many calculated expressions. Use them only in the cases where you really need them.

 

The little equals sign is your friend. Use it wisely.

 

HIC

 

Further reading related to this topic:

The Magic of Variables

The Magic of Dollar Expansions