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

Selecting last version of the row

Hello,

Could you please help me out with this problem:

I have for example fallowing table

TABLE_NAME:

LOAD * inline [

ID|Value|Version

1|3|1-1-2019

1|4|2-1-2019

3|8|1-1-2019

2|1|1-1-2019

5|2|1-1-2019

5|1|2-1-2019

] (delimiter is '|');

I would like to have fallowing result:

ID|Value|Version

1|4|2-1-2019

3|8|1-1-2019

2|1|1-1-2019

5|1|2-1-2019

So the output takes only newest version only if there is a updated, otherwise last version is applicable.

Thank you in advance!

 

Greetings

Przemyslaw

Labels (1)
2 Replies
joaopaulo_delco
Partner - Creator III
Partner - Creator III

I think you may use a group by clause.

 

Something like this:

Load ID, Value,

     Max(Version)

    resident (TABLE_NAME)

    group by ID, Value;

Help users find answers! Don't forget to mark a solution that worked for you!
przemyslaw_r
Contributor II
Contributor II
Author

Hi,

This solution could work if Value would be the same. In my case Value is changed with update.