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: 
jamielim
Contributor III
Contributor III

Use of Variables in Set Analysis

Hi,

I defined a variable as vRA=max([RA.Extract]).

Then, I have an expression Sum({$<[RA.Extract]={"$(=max([RA.Extract]))"}>}OutOfOrder)

max([RA.Extract]) evaluated to '05/08/2016' in KPI, format: auto.

Sum({$<[RA.Extract]={"$(=max([RA.Extract]))"}>}OutOfOrder) evaluated to give 7, format: auto

Sum({$<[RA.Extract]={"05/08/2016"}>}OutOfOrder) evaluated to give 7, format: auto


However, when I replace max([RA.Extract]) with vRA in the expression,

Sum({$<[RA.Extract]={"$(=vRA)"}>}OutOfOrder) evaluated to give 0, format: auto


Any idea why this is the case?

1 Solution

Accepted Solutions
marcus_sommer

It will depend on how the variable is exactly defined and which formatting will be returned (sense seems to work a bit different to qlikview regarding to max(AnyDate) which will return a numeric value like 42587 instead of '05/08/2016'). If you used:

vRA:

max([RA.Extract])

then you might need:

Sum({$<[RA.Extract]={"$(=$(=vRA))"}>}OutOfOrder)

and by

vRA:

=max([RA.Extract])

it changed to:

Sum({$<[RA.Extract]={'$(vRA)'}>}OutOfOrder)

More to them could you find here: The Magic of Variables‌ and here: The Magic of Dollar Expansions.

- Marcus

View solution in original post

2 Replies
marcus_sommer

It will depend on how the variable is exactly defined and which formatting will be returned (sense seems to work a bit different to qlikview regarding to max(AnyDate) which will return a numeric value like 42587 instead of '05/08/2016'). If you used:

vRA:

max([RA.Extract])

then you might need:

Sum({$<[RA.Extract]={"$(=$(=vRA))"}>}OutOfOrder)

and by

vRA:

=max([RA.Extract])

it changed to:

Sum({$<[RA.Extract]={'$(vRA)'}>}OutOfOrder)

More to them could you find here: The Magic of Variables‌ and here: The Magic of Dollar Expansions.

- Marcus

jamielim
Contributor III
Contributor III
Author

Thanks Marcus! Tried this and it worked