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

Table Join with chronological join

Hello everyone!!

I have the following tables

Table1: on this table i would like to be able to add the information about Delivery Number and Delivery Date that are saved on another table (Table 2). 

qlikviewaf_0-1657610222860.png

 

The join from table 2, needs to be done using Item + Location + Lotn and then assign the most recent Delivery Number and Delivery Date  to the table 1 - so the rows highlighted in green should be reported in the table1. 

Complexity of this, is that if for an item-lot-location i have 2 (or maybe more records, as it is for item B-NewYork-CC12) i have to first assign the most recent value (1239038) and then the less recent value (1928397). It's like a chronological assignemnt.

Does anyone know if this can be achieved with qlikview?

Thanks!!!

qlikviewaf_1-1657610222752.png

 

 

Labels (2)
1 Reply
BrunPierre
Master
Master

Using the first four records in Table2 to exemplify

 

Table1:
load * From Table1;

Table2:
Load * Inline[
ITEM,LOCATION,LOTN,DELIVERY NUMBER,DELIVERY DATE
A,SYDNEY,AKJI202,12890,10/01/2022
B,NEW YORK,CC12,13190,12/01/2022
B,NEW YORK,CC12,13490,14/01/2022
C,PARIS,AB88,13790,16/01/2022
C,PARIS,AB88,14090,18/01/2022

];

Left Join(Table1)
LOAD ITEM,
     LOCATION,
     LOTN,
Max([DELIVERY NUMBER]) as [DELIVERY NUMBER],
MAX([DELIVERY DATE]) as [DELIVERY DATE]

Resident Table2
Group By ITEM,
         LOCATION,
         LOTN
Order By ITEM;
DROP TABLE Table2;
EXIT SCRIPT;