QlikView - Use a variable into set analysis expression

JAEP picture JAEP · Feb 21, 2014 · Viewed 31.3k times · Source

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

Answer

Stefan Walther picture Stefan Walther · Feb 23, 2014

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