Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam_Thomas
Creator
Creator

Load only the latest rows of data using a date field

Hi

I have a table showing results of inspections on equipment. The table has all the historical inspections data but I want to only load the latest inspections based on the latest inspection date. 

How can I do this in the load script?

Example AS-IS data below:

Equipment_Number Inspection_Date Inspection_Status
1 01/01/2020 Pass
1

03/06/2022

Pass
1 08/03/2023 Pass
2 05/05/2019 Fail
2 08/12/2021 Pass
3 18/10/2019 Fail
3 23/03/2022 Fail

 

How I want it to load:

Equipment_Number Inspection_Date Inspection_Status
1 08/03/2023 Pass
2 08/12/2021 Pass
3 23/03/2022 Fail

 

Thanks

Labels (1)
1 Solution

Accepted Solutions
BrunPierre
Master
Master

Hi, a solution could be this.

Data:
LOAD Equipment_Number,
Inspection_Date,
Inspection_Status

FROM SourceTable;

Inner Join(Data)
LOAD Equipment_Number,
Max(Inspection_Date) as Inspection_Date

Resident Data

Group By Equipment_Number;

View solution in original post

2 Replies
BrunPierre
Master
Master

Hi, a solution could be this.

Data:
LOAD Equipment_Number,
Inspection_Date,
Inspection_Status

FROM SourceTable;

Inner Join(Data)
LOAD Equipment_Number,
Max(Inspection_Date) as Inspection_Date

Resident Data

Group By Equipment_Number;

Sam_Thomas
Creator
Creator
Author

Thank you!