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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get last 2 records

Hello,

I have a table where i have to get the last 2 records where the amounthave changed:

                                                                      Start Date                                         Amount  
4/30/2012 0:002066500 
4/30/2011 0:001767500           
6/30/2010 0:003000 
6/30/2010 0:0043000        
4/30/2010 0:0025000
11/30/2008 0:008000       
11/30/2008 0:00238000 
10/31/2008 0:0018000 
2/29/2008 0:00600 
2/29/2008 0:00118000    

can this be done without having to create a special table for this report from the script?

any suggestion?

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about:

=subfield(concat(DISTINCT Amount, ';', StartDate), ';', count(DISTINCT Amount))

for the last record.

=subfield(concat(DISTINCT Amount, ';', StartDate), ';', count(DISTINCT Amount)-1)

and the next to last record.

-Rob

http://robwunderlich.com