Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
kushalthakral
Creator III
Creator III

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

Hi All

Just wanted to know what is the difference between $(Variable) and $(=Variable) while using them in Set Analysis

Thanks

Kushal Thakral

1 Solution

Accepted Solutions
marcus_sommer

In this simple case it looked identically - but it isn't. The difference here is where the variable-content will be evaluated. By $(=Variable) is it inside from the $-sign expansion and $(Variable) will be evaluated within the field respectively expression in which it is embedded.

The best explanation will you find within the link above and here: The Magic of Variables.

- Marcus

View solution in original post

10 Replies
marcus_sommer

Variable: 1+2

$(Variable) returned 1+2

$(=Variable) returned 3

The Magic of Dollar Expansions

- Marcus

kushalthakral
Creator III
Creator III
Author

Hi Marcus

I have checked if you use =$(Variable) in a text object or =$(=Variable), both are giving same result

i have defined Variable value 1+2 in variable overview.

Regards

Kushal Thakral

vikasmahajan

PFA document

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
swuehl
MVP
MVP

Have also a look at

The Little Equals Sign

and the comments below this blog post.

I think the example using simple arithmetic is also not the best example, compare an aggregation like Max(Date) put into a variable and expanded in e.g. a chart dimensional context.

marcus_sommer

In this simple case it looked identically - but it isn't. The difference here is where the variable-content will be evaluated. By $(=Variable) is it inside from the $-sign expansion and $(Variable) will be evaluated within the field respectively expression in which it is embedded.

The best explanation will you find within the link above and here: The Magic of Variables.

- Marcus

jonathandienst
Partner - Champion III
Partner - Champion III

Simply put the difference is where the expression is evaluated:

$(Variable)

returns the expanded variable, which may then be evaluated by the expression. May be evaluated many times in a table.

$(=Variable)

evaluates the expression in the variable, and the value is returned. Evaluated once in a table or chart.

It is similar to the difference between a variable defined without a leading equals sign, or with a leading equals sign

EDIT - beaten to the punch by Marcus.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
kushalthakral
Creator III
Creator III
Author

Thank You All for your replies.

Regards

Kushal Thakral

alsale_1968
Contributor III
Contributor III

Hi,

Thanks. It has been very useful to me.

ayandey18
Partner - Contributor II
Partner - Contributor II

Can anybody explain how the following expression perform on the run-time

vCompare =   $(=If($(vTYMTDSales) - $(vLYMTDSales) > 0,0,1))

 vCompare =   =If($(vTYMTDSales) - $(vLYMTDSales) > 0,0,1)