Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
csanchez83
Contributor
Contributor

Calcular Fecha mas Reciente

Hola:

Tengo las siguientes 2 tablas:

PRODUCTOS

Clave_Producto    Fecha_Ultima_Compra

1, ''

2, ''

3,''

 

MOVIMIENTOS

Clave_Producto       Fecha_Movimiento

1, '05-Sept-2019'

1, '02-Oct-2019'

2, '01-Ene-2018'

1, '02-Mar-2019'

 

Como le puedo hacer para que la Fecha más reciente que esta en la tabla MOVIMIENTOS se almacene en la tabla PRODUCTOS ??

 

Saludos!!

Labels (1)
1 Reply
Saravanan_Desingh
MVP
MVP

Are you looking something like this?

PRODUCTOS:
LOAD * INLINE [
    Clave_Producto, Fecha_Ultima_Compra
    1
    2
    3
];

MOVIMIENTOS:
LOAD *, Date(Date#(Fecha_Movimiento,'DD-MMM-YYYY')) As Dt;
LOAD * INLINE [
    Clave_Producto, Fecha_Movimiento
    1, 05-Sep-2019
    1, 02-Oct-2019
    2, 01-Feb-2018
    1, 02-Mar-2019
];

Left Join(PRODUCTOS)
LOAD Clave_Producto, FirstSortedValue(Fecha_Movimiento, -Dt) As MostRecentDate
Resident MOVIMIENTOS
Group By Clave_Producto;

Drop Table MOVIMIENTOS;

commQV54.PNG