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: 
Not applicable

Ligar duas tabelas e obter o último custo

Prezados, boa tarde!

Possuo duas tabelas sendo 1 de custo (cost) e a outra de vendas (sales). Eu necessito ligar essas duas tabelas onde o resultado esperado é o que está logo abaixo. (caso não tenha custo naquela data trazer sempre o último custo).

Cost:

LOAD SkuCost,Cost,Date  INLINE [  

  SkuCost,Cost,Date

    SKU1, 10, 2013-01-13

    SKU1, 11, 2013-07-01

    SKU1, 12, 2013-11-09

    SKU2, 20, 2013-01-15

    SKU2, 21, 2013-11-20

];

Sales:

LOAD SkuSale,Value,DateSale  INLINE [  

  SkuSale,Value,DateSale

     SKU1, 15, 2013-01-13

     SKU1, 15, 2013-01-15

     SKU1, 16, 2013-01-16

     SKU1, 15, 2013-01-17

     SKU1, 13, 2013-06-02

     SKU1, 14, 2013-07-03

     SKU1, 16, 2013-12-28

     SKU2, 20, 2013-01-15

     SKU2, 20, 2013-01-16

     SKU2, 20, 2013-01-20

     SKU2, 20, 2013-11-20

     SKU2, 21, 2013-11-21

];

/*

the expected result would be

  SkuSale,Value,DateSale, CostSale

     SKU1, 15, 2013-01-13, 10

     SKU1, 15, 2013-01-15, 10

     SKU1, 16, 2013-01-16, 10

     SKU1, 15, 2013-01-17, 10

     SKU1, 13, 2013-06-02, 10

     SKU1, 14, 2013-07-03, 11

     SKU1, 16, 2013-12-28, 12

     SKU2, 20, 2013-01-15, 20

     SKU2, 20, 2013-01-16, 20

     SKU2, 20, 2013-01-20, 20

     SKU2, 20, 2013-11-20, 21

     SKU2, 21, 2013-11-21, 21

];

*/

Thanks for any help.

2 Replies
nicolett_yuri

Resolvi utilizando o IntervalMatch extendido.

Da uma olhada

Not applicable
Author

Obrigado Yuri,

Exatamente o que precisava.