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

last but one year

Hi i have  requirement like displaying sales of  last but one year not current year-1.

year field is like 2014 and 2011 and 2008 like this not in order .

1 Solution

Accepted Solutions
Nicole-Smith

You can find the second highest year by using:

max(Year, 2)

So to sum sales, something like:

sum({<Year={$(=max(Year, 2))}>}Sales)

View solution in original post

2 Replies
Nicole-Smith

You can find the second highest year by using:

max(Year, 2)

So to sum sales, something like:

sum({<Year={$(=max(Year, 2))}>}Sales)

hic
Former Employee
Former Employee

In the script, in the master calendar you should define a flag for last year:

  If( Year(Date) = Year(Today())-1, 1, 0) as IsLastYear,

Then you can use this in a Set Analysis expression:

  Sum ( {$<IsLastYear={1}>} Amount )

HIC