Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
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