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: 
zagzebski
Creator
Creator

Expression (set analysis) variable

I tried to set up the following variable:

Let vIncomeMaxYear = 'Sum( {$<[Account Type]={Income}, Calendar_Year={$(=Max(Calendar_Year))}>} [Amount GL])';

But when I load the file the variable comes back as:

Sum( {$<[Account Type]={Income}, Calendar_Year={}>} [Amount GL])

New to creating variables for expressions...

Steve

2 Replies
stabben23
Partner - Master
Partner - Master

Hi, try to use the "search" inside here, like this: Calendar_Year={"$(=Max(Calendar_Year))"}

maxgro
MVP
MVP

maybe

let vIncomeMaxYear = replace('Sum( {$<[Account Type]={Income}, Calendar_Year={"^(=Max(Calendar_Year))"}>} [Amount GL])', '^', '$');

or you can load variables from an external file (txt, excel; there are a lot of post on this in the community)

excel is attached; copy the excel in the same dir as your QlikView .qvw

and add this to your QlikView .qvw to load the variables from excel

Directory;

TempVariable:

LOAD Var,      Val

FROM   [Variables.xlsx]

(ooxml, embedded labels, table is Sheet1);

For i = 0 to NoOfRows('TempVariable')-1

  LET vName = Peek('Var', i, 'TempVariable');

    LET $(vName) = Peek('Val', i, 'TempVariable');

Next i;

LET i = Null();

LET vName = Null();

Drop Table TempVariable;