Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor III

compare value

Hi Community,

I am confused and need support.

I need to compare the data for the field Weight moved in the year 2014 with those of 2015 and represent them through kpi going to highlight the difference between the two years .

I select Year 2015

Green: current year

kpi use an expression  ........Sum(TotalWeight) and data are correct.

Blu: previous year

When I input 2014 (Blu), kpi use an expression  Sum({$ <vPreviousYear={'$(=vCurrentYear)-1)'}>} TotalWeight)


sum all data TotalWeight that have PreviousYear = 2014

but It represents the data of 2015 and NOT 2014.

What escapes me?

I'm Immagine.png

2 Replies
Honored Contributor II

Re: compare value


Sum({$ <Year={'$(=vCurrentYear)-1)'}>} TotalWeight)

Not sure why you need to store previous year as a variable where current year is already set.

To trouble shoot your dashboard

1. use a kpi to display your variable values and check its being set correctly

2. try hard coding the years in your formula and getting it working for 2015/2014 then replace with your variables.

Honored Contributor II

Re: compare value

Hi Fabio,

Firstly when you are selecting 2015 as you did in the green box, make sure that the blue box does not respond to the selections made by those buttons.

Once you input value into the input box you can directly use the following expression:

Sum({$ < year ={ "$(varInputVariable)" } >} TotalWeight )

Assuming that the variable being updated by the input box is 'varInputVariable'.


Sangram Reddy.