Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
hic
Former Employee
Former Employee

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 it as 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

16 Comments
Marcio_Campestrini
Specialist
Specialist

Hi Henric

Thanks for sharing!

0 Likes
9,444 Views
Not applicable

Thanks Henric,

$(=vEndYear-1) Just sorted my issue out. 

Thanks

0 Likes
9,444 Views
Anonymous
Not applicable

Henric nailed it again - equal sign behaving differently in different places was one of the things that frustrated me the most when I started my journey with QlikView.

9,444 Views
Not applicable

I just started with QV and I was wandering why sometimes i needed equal and others dont. Thanks for clarifying it completly.

0 Likes
9,444 Views
kalyandg
Partner - Creator III
Partner - Creator III

Hi Henric

Thanks for your post.

0 Likes
9,444 Views
Anonymous
Not applicable

One of the things I don't like in Qlik View.

Good post.

0 Likes
9,444 Views
juraj_misina
Luminary Alumni
Luminary Alumni

I'm still wondering why I can use $(vMaxYear) in an expression title without equal sign, but I have to use equal sign in a chart title or caption 😕

0 Likes
7,644 Views
Anonymous
Not applicable

Simple,

Because on chart title or caption the = is the first character.

You can use $(xxxx) as a title.  Is different of =$(xxx)

0 Likes
7,644 Views
juraj_misina
Luminary Alumni
Luminary Alumni

Antonio Caria: what I ment is that in expression label you can simply write "Actual $(vMaxYear)" without equal sign and the variable is evaluated. But doing exactly the same in chart title or caption does not work. In chart title - as you write - I have to write "='Actual $(vMaxYear)' ".

0 Likes
7,644 Views
Anonymous
Not applicable

Correct.

In caption's (titles included) the behavior is different from expression.




0 Likes
7,644 Views