Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
haymarketpaul
Creator III
Creator III

Only Display Rows With Highest Date

I have data like the following where users have registered more once in the same system but with different details and i want the latest row for each user based on the FinalRecencyDate.

It is the GMC number that determines the users are the same regardless of name or email so i just want to display the latest one

UserIDFirstnameLastnameEmailGMCFinalRecencyDate
1JoeBloggsjb@myemail.com123456715/02/2015
2-Bloggsjoebloggs@email.com123456702/04/2015
3JaneDoejane@email.co.uk765432102/01/2015
4JDoejane.doe@email.com765432123/03/215

So looking at the above data i would only want to display UserID 2 and UserID 4

Any ideas how best to filter out the unneeded rows?  Ultimately i just need it in a straight table or table box to output and pass on to someone.

I've tried using Group By but there are actually about 40 fields in total so not sure that's wise

1 Solution

Accepted Solutions
Anonymous
Not applicable

4 Replies
Anonymous
Not applicable

See attached

Anonymous
Not applicable

You could try like below,

Data:

LOAD * INLINE [

    userid, fname, lname, email, gmc, frdate

    1, Joe, Bloggs, jb@myemail.com, 1234567,02/15/2015

    2, -, Bloggs, joebloggs@email.com, 1234567,04/02/2015

    3, Jane, Doe, jane@email.co.uk, 7654321,01/02/2015

    4, J, Doe, jane.doe@email.com, 7654321,03/23/2015

];

Data2:

NoConcatenate

Load

userid,

fname,

lname,

email,

gmc as gmc2,

frdate

resident Data

where not Exists(gmc2,gmc)

order by

frdate desc

;

drop table Data;

maxgro
MVP
MVP

source:

LOAD UserID,

     Firstname,

     Lastname,

     Email,

     GMC,

     FinalRecencyDate

FROM

[https://community.qlik.com/thread/159701]

(html, codepage is 1252, embedded labels, table is @1);

final:

NoConcatenate load *

Resident source

where Peek(GMC)<>GMC                             // only the first GMC

order by GMC, FinalRecencyDate desc;          // order by .........

DROP Table source;

haymarketpaul
Creator III
Creator III
Author

Thanks All - 3 interestingly different answers