Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
AdrianCittadini
Contributor II
Contributor II

What's the difference between these expressions?

Hi, I would like to understand the use of $ symbol on expressions like this:

Sum({<Year={2022}>}Sales)

Sum({$<Year={2022}>}Sales)

I understand that $ is used to evaluate the expression in front of it, but in these cases I don't seem to see the difference.

Thanks for the help!

Labels (3)
1 Solution

Accepted Solutions
JPanzer
Partner - Contributor II
Partner - Contributor II

The $ is the default state, it means all sales in the current selection that belong to the year 2022.

If there is nothing in front of the <, in the background it still uses the $

View solution in original post

3 Replies
hic
Former Employee
Former Employee

In most cases there is no difference. But there are cases where the difference is big...

The set expression is usually like {$<SetModifier>}. That means that it takes the current selection of the default state ($) and modifies this using the SetModifier.

But if you instead have {<SetModifier>} then it takes the context and modifies this. The "context" is whatever state or set expression you have "outside" the set expression.

Example 1: You have an object that belongs to an alternate state. Then the current selection of this state is the context.
Example 2: You have a set expression inside an aggregation function inside an Aggr() with a set expression, e.g. Sum(Aggr({$<...>} Count({...} X),Dim)). Then the context for the inner set expression is the set expression in the Aggr().
Example 3: It is now possible to have a set expression for the entire object, the qContextSet. This is the context for all aggregation functions inside the object.

JPanzer
Partner - Contributor II
Partner - Contributor II

The $ is the default state, it means all sales in the current selection that belong to the year 2022.

If there is nothing in front of the <, in the background it still uses the $

Swtnk011
Contributor
Contributor

in simple words i think writing {$} before/in expression will make it change with filter while using{1} will fix it even when some filter is applied outside.