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: 
rupaliqlik
Partner - Creator
Partner - Creator

Fetch second last record from date column.

Hi Team,

I have  a data set where I have one date column and other is patient id.User want to show second last date in report.

I used previous function but it is not working fine.Kindly help me.

rupaliqlik_0-1686054173881.png

Below is my code

[SR Infusion Temp]:
LOAD
[Patient ID] ,
[SR Infusion DOT],
Peek([SR Infusion DOT],-1) as _commondate
Resident [SR Infusion]
order by [Patient ID],[SR Infusion DOT] ASC;
DROP Table [SR Infusion];
RENAME Table [SR Infusion Temp] to [SR Infusion];

 

@abhijitnalekar , ,Kaushik Solanki

Labels (2)
1 Reply
a_mullick
Creator III
Creator III

Hi,

See if this helps.

I've put in a set analysis solution and an alternative scripted solution, but basically you should be able to do what you want using the FirstSortevalue() function.