Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have the below set of data (<Time, Column1, Column2,Column3>)where Time should be the primary key but since there are duplicates in Time. I have to remove the first occurrence of 'Time' and consider the second or the last occurrence.
| Time | Column1 | Column2 | Column3 | RowNo() |
| 25/10/16 8:00:00 PM | 2 | 3 | 4 | 1 |
| 25/10/16 8:00:00 PM | 3 | 5 | 6 | 2 |
| 25/10/16 9:00:00 PM | 4 | 6 | 3 | 3 |
| 25/10/16 10:00:00 PM | 2 | 4 | 9 | 4 |
| 25/10/16 10:00:00 PM | 4 | 7 | 8 | 5 |
For this, I added RowNo() to the table and thought of considering the row with Maximum value for a particular Time.
Is there any way to remove the first occurrence from the data itself and get the below result in the LOAD Script.
| Time | Column1 | Column2 | Column3 | RowNo() |
| 25/10/16 8:00:00 PM | 3 | 5 | 6 | 2 |
| 25/10/16 9:00:00 PM | 4 | 6 | 3 | 3 |
| 25/10/16 10:00:00 PM | 4 | 7 | 8 | 5 |
Thanks and Regards,
Anjali Gupta
Source:
LOAD
Timestamp#(Time, 'DD/MM/YY hh:mm:ss ff') as Time,
Column1,
Column2,
Column3,
[RowNo()]
FROM
[https://community.qlik.com/thread/237954]
(html, codepage is 1252, embedded labels, table is @1)
;
Final:
NoConcatenate load * Resident Source
Where Time <> Peek('Time')
order by Time desc;
DROP Table Source;