JAEP
JAEP

Reputation: 383

QlikView - Use a variable into set analysis expression

I've the variable varCurrentYear

varCurrentYear = Year(Today())

And I wrote this set analysis expression

Expression

The result it’s not correct. By the way If the variable is declared in this way

varCurrentYear = 2014

The result is correct.

Why? Thank's

Upvotes: 3

Views: 32167

Answers (3)

I'd use:

=Sum({<Year={$(=varCurrentYear)}>}Orders)

Upvotes: 0

user1141785
user1141785

Reputation: 551

I know it looks strange, but you have to write:

=sum({<Year={"$(=$(varCurrentYear))" } >} Orders)

The QlikView parser can evaluate the double-nested variable for some reason.

Upvotes: 3

Stefan Walther
Stefan Walther

Reputation: 938

I'd use

Sum({$<Year={'$(varCurrentYear)'}>}Orders) 

resp without quotes if varCurrentYear is numeric

Sum({$<Year={$(varCurrentYear)}>}Orders)

See http://tools.qlikblog.at/SetAnalysisWizard/?sa=MCKA

Regards Stefan

Upvotes: 3

Related Questions