Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Show last 2 years in chart

Hi everyone,

Beginners question. I'm looking for the possibility to show only the 2 latest years from a data set in a graph. I've tried using the 'enable conditional' option on the dimensions tab, however have not managed to write the appropriate condition.

My first attempt looked similar to if(YEAR=2014, YEAR, 0) So if the year is 2014, show year else show nothing.

I hope to be pointed to some reading material/examples!

Thnx!

1 Reply
Michiel_QV_Fan
Specialist
Specialist

Barry Harmsen's book QlikView for developers is great.

For your issue:

sum({<Year = {$(=max(year))}>}Your_field)     for the latest year

and

sum({<Year = {$(=max(year)-1)}>}Your_field)     for the previous latest year

Combined in 1 expression gives you the total, just add the 2 separate expressions in 1 and let the add ( + )

sum({<Year = {$(=max(year))}>}Your_field)     + sum({<Year = {$(=max(year)-1)}>}Your_field)