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

Choose the latest date

Hi all,

I got problem,

That is, how can i choose the latest date from the source.

The File structure will be like that.

ItemDatePrice
A1/5/201012
A3/5/201015
A6/5/201016
B1/5/20101
B5/5/20103

I want to extract the record is Only Item A (6/5/2010) and Item B (5/5/2010)

Thanks and Best Regards,

kzorrw

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

you can use the following code

tab1:

LOAD * INLINE [

Item, Date, Price

A, 1/5/2010, 12

A, 3/5/2010, 15

A, 6/5/2010, 16

B, 1/5/2010, 1

B, 5/5/2010, 3

];

load Item,max(Date) as maximum resident tab1 group by Item;

it should work fine

thanks



View solution in original post

3 Replies
Not applicable
Author

Hi,

you can use the following code

tab1:

LOAD * INLINE [

Item, Date, Price

A, 1/5/2010, 12

A, 3/5/2010, 15

A, 6/5/2010, 16

B, 1/5/2010, 1

B, 5/5/2010, 3

];

load Item,max(Date) as maximum resident tab1 group by Item;

it should work fine

thanks



Not applicable
Author

hi tauqueer,

Thanks a lot for your reply.

Your code work well.

Thanks

kzorrw

Not applicable
Author

tab1:

LOAD * INLINE [

Item, Date, Price

A, 1/5/2010, 12

A, 3/5/2010, 15

A, 6/5/2010, 16

B, 1/5/2010, 1

B, 5/5/2010, 3

];

inner keep load Item,max(Date) as Date resident tab1 group by Item;

this way you will only get the latest record per each item.