Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Try to add an equal sign after the parenthesis within the dollar sign expansion
Avg({$<[Year]={$(=vCurrentYr)}>}[Unit Price])
Hi Sunny,
Thank you for your reply. Unfortunately it did not solve the issue, the equation returns blank.
How about this
Avg({$<[Year]={$(=$(vCurrentYr))}>}[Unit Price])
That did it! Thank you!!