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: 
Marco_Car
Contributor
Contributor

How to avoid duplicate rows with scripts

Good Morning,

I have a table like:

Request, modified on

a, 31/12/2018

a, 01/01/2019

a, 02/02/2019

b, 03/02/2019

b,10/02/2019

I just want to obtain a table with the last modified record.

Which can be the right script?

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Here is another approach

Table:
LOAD * INLINE [
    Request, modified on
    a, 31/12/2018
    a, 01/01/2019
    a, 02/02/2019
    b, 03/02/2019
    b, 10/02/2019
];

Right Join (Table)
LOAD Request,
	 Max([modified on]) as [modified on]
Resident Table
Group By Request;

View solution in original post

5 Replies
sunny_talwar
MVP
MVP

So, based on the input provided what is the output you are hoping to get from the script?

Marco_Car
Contributor
Contributor
Author

Hi

The desiderata should be:

a, 02/02/2019

b,10/02/2019

 

Thank you

sunny_talwar
MVP
MVP

Here is one option

Table:
LOAD Request,
	 Date(Max([modified on])) as [modified on]
Group By Request;
LOAD * INLINE [
    Request, modified on
    a, 31/12/2018
    a, 01/01/2019
    a, 02/02/2019
    b, 03/02/2019
    b, 10/02/2019
];
sunny_talwar
MVP
MVP

Here is another approach

Table:
LOAD * INLINE [
    Request, modified on
    a, 31/12/2018
    a, 01/01/2019
    a, 02/02/2019
    b, 03/02/2019
    b, 10/02/2019
];

Right Join (Table)
LOAD Request,
	 Max([modified on]) as [modified on]
Resident Table
Group By Request;
amrinder
Creator
Creator

Hi Marco,

 

Please go through the below script:

 

Raw:
Load * Inline[
Request,modified
a,31/12/2018
a,01/01/2019
a,02/02/2019
b,03/02/2019
b,10/02/2019
];

NoConcatenate
T1:
LOAD
Request,
Date(Date#(modified,'DD/MM/YYYY'),'DD/MM/YYYY') as modified
Resident Raw;

DROP Table Raw;

Inner Join
LOAD
Request,
Date(Max(Date#(modified,'DD/MM/YYYY')),'DD/MM/YYYY') as modified
Resident T1 Group By Request;

 

Hope it helps.