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: 
Eaun
Contributor III
Contributor III

Get last date for each record

I want to get get the last date for each part number received into seperate field in the load scripTt what is the best way to go about this ?

1 Solution

Accepted Solutions
Vegar
MVP
MVP

You could do as in script below. First pick out the max date per part and then join in the qty for that date. 

Data:
Load
   part,
   Max(date) as date
From 
   EXCEL.xlsx (...)
Group by 
   part
;

LEFT JOIN (Data)
LOAD 
   part, 
   date, 
   qty
FROM Excel.xlsx (...);

 

View solution in original post

3 Replies
Vegar
MVP
MVP

Load *
From
EXCEL.xlsx (...);

Left join
Load
part,
Max(date) as maxdate
From EXCEL.xlsx (...)
Group by part;
Eaun
Contributor III
Contributor III
Author

Thanks for that but what if I wanted to just have the max date for that part only with the qty ?

How would I do that ?

Vegar
MVP
MVP

You could do as in script below. First pick out the max date per part and then join in the qty for that date. 

Data:
Load
   part,
   Max(date) as date
From 
   EXCEL.xlsx (...)
Group by 
   part
;

LEFT JOIN (Data)
LOAD 
   part, 
   date, 
   qty
FROM Excel.xlsx (...);