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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
mazacini
Creator III
Creator III

Load only fields where date is max date

I have a table with Code and Date, where multiple Dates for any Code.

I want to load Code, Date but only where Date is the maximum Date for that Code.

CodeDate
AJan 1
AApr 1
AAug 20
BFeb 2
BFeb 3

So for above, it will load

Aug 20
CodeDate
A
BFeb 3

Any ideas please?

1 Solution

Accepted Solutions
Not applicable

You can do it in one step:

Table:

LOAD

     Code,

     Max(Date) as Date

FROM ...

GROUP BY Code;

If you have more fields in that table, you will need a second step:

Left Join (Table)

Load   

     Code,

     Date,

     ...

From...

This will only join the data of Codes with Max DAte.

View solution in original post

2 Replies
Not applicable

You will need to create a temp table containing the max value, you then use the PEEK function to get the value to use later

Not applicable

You can do it in one step:

Table:

LOAD

     Code,

     Max(Date) as Date

FROM ...

GROUP BY Code;

If you have more fields in that table, you will need a second step:

Left Join (Table)

Load   

     Code,

     Date,

     ...

From...

This will only join the data of Codes with Max DAte.