3

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

JAEP
  • 363
  • 2
  • 5
  • 12

3 Answers3

3

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

Stefan Walther
  • 929
  • 1
  • 8
  • 30
  • Hi Stefan, I have the same problem and I have tried your tips and the set Analysis generator. but it does not worked. May you please have a look on my question which I have just asked. http://stackoverflow.com/questions/37411577/using-variables-in-set-analysis-expressoin – Ziad Salem May 24 '16 at 11:00
3

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.

user1141785
  • 431
  • 7
  • 21
0

I'd use:

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