Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

fmazzarelli
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)

translating

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
ogster1974
Honored Contributor II

Re: compare value

Try

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.

reddys310
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'.


Thanks,

Sangram Reddy.