Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Doran_Qlik
Contributor II
Contributor II

How to show only latest entry in data table?

Hello, I have a spreadsheet that I have put in the Data Load Editor for "Offers" tagged against a "Project".  For some projects, there are multiple offers tagged for this and I would like the table to only show the most recent offers for each project and ignore any previous offers.

Below is my data set in Qlik: 

Offer_Dates:
Load
Project_ID,
Offer_ExpiryDate,
Offer_DateEntered,
Offer_ID,
 OfferID &'_'& date(Offer_DateEntered, 'DD-MMM-YY') as Offer_IDDate
 

I basically want it to only show these inputs for the most recent "Offer_DateEntered" but I am not sure how to do this. 

Thanks!

Labels (1)
1 Reply
snibrahim1993
Partner - Contributor III
Partner - Contributor III

Hi @Doran_Qlik 

Sort the data by the "Offer_DateEntered" field in descending order using the "Order by" statement in your load script. This will ensure that the most recent offers appear first.
Offer_Dates:
Load
Project_ID,
Offer_ExpiryDate,
Offer_DateEntered,
Offer_ID,
OfferID &'_'& date(Offer_DateEntered, 'DD-MMM-YY') as Offer_IDDate
ORDER BY Offer_DateEntered DESC;

Load the sorted data into a new table, but limit the number of rows to only one using the "First" function.
LatestOffer:
LOAD
First(Project_ID) as Project_ID,
First(Offer_ExpiryDate) as Offer_ExpiryDate,
First(Offer_DateEntered) as Offer_DateEntered,
First(Offer_ID) as Offer_ID
Resident Offer_Dates;

Drop the original "Offer_Dates" table to remove it from the data model.
Drop Table Offer_Dates;

Rename the resulting table "LatestOffer" to "Offer_Dates" to keep the table name consistent.
Rename Table LatestOffer to Offer_Dates;

Help users find answers! Don't forget to mark a solution that worked for you! If already marked, give it a thumbs up!
Regards, Mohamed Ibrahim.
If this resolves your Query please like and accept this as an answer.