8 Replies Latest reply: Mar 3, 2015 10:20 AM by Omer Demir RSS

    Set Analysis Expression Using Variables

      Hi guys. I have a question (or two) regarding to variables behaviour on Qlikview

       

      I have two variables with max year and max month from a dates set.

       

      I declared the variables on the script with SET and LET (trying to figure it out why it doesn't work), I have the declaration like this:

      SET vMaxYear='Max(YearFromDate)';

      SET vMaxYear='=Max(YearFromDate)';

       

      I'm using vMaxYear in a set analysis expression like: SUM({$<Year={$(=vMaxYear)}>} Sales)

       

      I have tried with the equal (in definition, and in the set analysis), without it and have no luck. Strange enough, I defined the variable through Variable Overview window and that way it worked but I think that script it's better place (for reuse and so) to define variables not Variable Overview.

       

      I can attach some example file if you need to, can you point me in the right direction here? I see documentation incomplete in this aspect as it only says SET stores expressions without evaluating them, LET stores values from evaluated expressions (in my understanding)

       

      Thanks in advance