4 Replies Latest reply: Feb 2, 2018 12:21 PM by John delligatti RSS

    Variables and Set Analysis

    John delligatti

      Hi All,

       

      I am attempting to use a variable for max year in order to create a chart showing year over year pricing increases in Qliksense. I've successfully created the chart using  if( Year='2017',avg( [Unit Price],)) , same with 2016 and so forth. That said my boss is encouraging me to use variables to accomplish this to get familiar with them for future use.

       

      I have the variable name set to vCurrentYr, with the variable set to max([Year])

       

      To ensure I created the variable correctly I dropped it into a KPI box and it returned 2017, the max year from my data set.

      However, when I enter the variable into my equation, I cannot for the life of me get it to work. The equation I've created is  avg({$<[Year]={$(vCurrentYr)}>}[Unit Price])

       

      I've looked at all the posts I can find in this forum as well as youtube videos, as far as I can tell the syntax is correct. Would someone be able to assist?

       

      Thank you.