Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
elys_k
Contributor
Contributor

Duplicate records - Filter by earliest record

I inherited a number of Qlikview reports from my predecessors.

One of the reports contains a table with receipt records, including a unique ID, a Sales number, Datetime and various other sales fields.

It's come to light that there is a scenario in which existing receipts are reprinted and therefore reprocessed with another unique id causing a duplicate sales number record in the table.

The end user has requested a way to filter out all of the duplicate rows from the table. How can I identify the earliest record based on the datetime, where there are duplicate Sales Numbers and filter out the other duplicates. The table currently uses the dimension of the unique ID.


Labels (2)
1 Reply
Brett_Bleess
Former Employee
Former Employee

This depends upon whether you want both records in the data model or not, as if not, then in the script you could do an order by statement to order all the records then use peek() to check if the next record has the same receipt etc. and just grab the last one etc.  If you need both records, then the other approach would be to use a flag field I think where a 'y' means that is the most current record and an 'n' means it is not, then use the y in the expressions etc., you may need to doe some Set Analysis in that case though.  Sorry I cannot give you something more specific here, and you may get some further help if you can provide some sample data folks could actually see things, then they may be able to help you further, but hopefully this may get you on the right track.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.