Understanding the equal symbol usage in Variable

The advantage of using the Variable is reuse. The variable defined in qlikview will be the global and they can be static or calculated.

The variable created by Variable Overview in front end that starts with the equal symbol will directly calculated by qlikview. An expression that does not start with equal symbol will not be calculated remains static.

Here the example which shows the exact difference between two usages. Let say an application has sales data per Region.

Region Sales
Asia 120
Asia 400
Africa 1000
Africa 900
North America 500
North America 600

Variable called vSales that has expression to calculate the sum

vSales = (sum(sales))

When using this variable in chart will gives string sum(sales). This expression can be calculated by using $ sign before the variable.

Region vSales $(vSales)
Asia sum(sales) 520
Africa sum(sales) 1900
North America sum(sales) 1100

The result will be the sum of individual regions.

When a variable is defined with equal symbol,

vSales1= (=sum(sales))

The result will be the total value of all regions in each row of the table.

Region vSales $(vSales) $(vSales1)
Asia sum(sales) 520 3520
Africa sum(sales) 1900 3520
North America sum(sales) 1100 3520

Variable is extremely powerful in developing qlikview applications and should be used with care.

By: Sivaraj Seeman

No Comments

Leave a Comment

Your email address will not be published.