Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

When to use = in expressions?

Hello, I'm new to QlikView, but I have some experience as a programmer. My question is: sometimes I see examples both on this site and in the .qvw documents I work on where an expression, calculation condition, or other conditional starts with an = sign and sometimes not.

What is the difference? For example, this is the expression definition in one of our charts:

Sum({$<[ContractType] = {"Technical Document","Informational"}>} [Focused Contracts])

what if it were:

=Sum({$<[ContractType] = {"Technical Document","Informational"}>} [Focused Contracts])

1 Solution

Accepted Solutions
Gysbert_Wassenaar

It often doesn't matter. Where is does matter is in variables. If a variable contains an expression the = sign then the expression will be evaluated directly and not in the context of the chart the variable is used in. See attached qvw for an example. The chart has two expressions that each use a variable. The first variable contains an expression that starts with the = sign. It returns the overall maximum transaction date. The second expression returns the maximum transaction date for the SalesPerson. That's because the expression in the first variable is calculated before the dimension values are applied. The second takes the dimension value into account and so returns the maximum transaction date for the individual sales persons.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
nizamsha
Specialist II
Specialist II

=Sum({$<[ContractType] = {"Technical Document","Informational"}>} [Focused Contracts])

first  sum([Focused Contracts])   actually this is a expressinon

second one {$<[ContractType] = {"Technical Document","Informational"}>} inside the expression we r writing set analysis for dynamic calculation

ContractType is a fieldname

"Technical Document  and Informational is a value in contract type field

for eg

year //this is a field name

2007// these and all values

2008

2009

2010

in set wwe use =before the function eg(=MAx(sales)) or (=only(sales)),(=year(currentyear)) like ths wwe use

Gysbert_Wassenaar

It often doesn't matter. Where is does matter is in variables. If a variable contains an expression the = sign then the expression will be evaluated directly and not in the context of the chart the variable is used in. See attached qvw for an example. The chart has two expressions that each use a variable. The first variable contains an expression that starts with the = sign. It returns the overall maximum transaction date. The second expression returns the maximum transaction date for the SalesPerson. That's because the expression in the first variable is calculated before the dimension values are applied. The second takes the dimension value into account and so returns the maximum transaction date for the individual sales persons.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

It makes also a difference (similar to a variable in effect) in places like text boxes, expression labels, chart titles, etc.

today()

put in a text box just outputs 'today()', while

=today()

returns today's date.

Not applicable
Author

Ok thank you, I think I understand your explanation and what is being displayed in the chart. However, how do I view the variables in your example? I haven't worked with variables yet, and when I click on the chart properties and view the expressions, they are listed $(vMaxDate1) and $(vMaxDate2) with no = sign in either one. Where are the variables made?

Gysbert_Wassenaar

You can find the variables in the Variable Overview window that can be opened from the Settings menu or with the key combination ctrl+alt+v.


talk is cheap, supply exceeds demand