Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
master_student
Creator III
Creator III

2017vS2016

Hello Guys,

I have a variation expression that compares year 2017 VS 2016 until today -1

The problem is that counts all values of 2016 including values where date is > today -1 ; the variation becomes false, any idea how to change this expression so it will compare values until 20 october of the two years

I hope I am clear. Here is my expression :

=num((num(sum( {$<[Year of date]={$(=Max([Year of date]))}>} recharge_amount),'# ##0') // 2017

- num(sum( {$<[Year of date]={$(=Max([Year of date])-1)}>} recharge_amount),'# ##0')) //2016

/ num(sum( {$<[Year of date]={$(=Max([Year of date])-1)}>} recharge_amount),'# ##0') *100,'# ## % ') //2016

Capture.PNG

Thanks in advance for your help

1 Reply
Mark_Little
Luminary
Luminary

I would Normally approach a probably like this in Script.

I add flags to my calendar for periods I am interested in.

Like below

IF(YEAR(TempDate)= YEAR(ADDYEARS(TODAY(1),-1)) AND TempDate <= ADDYEARS(TODAY(1),-1),1) AS F_CAL_LYD,

The use the set analys

SUM({<F_CAL_LYD={1}>}Amount).

But in set analysis you can use something like

SUM({<DATE={'>=$(YEARSTART(ADDYEARS(TODAY(),-1))),<=$(ADDYEARS(TODAY(),-1)))'}>})

Mark