Delete all rows with duplicate values in column in Palantir Foundry Countor

74 Views Asked by At

In a contour analysis with over 2 million rows I need to remove all rows where the 1st column WORKORDER_ID is a duplicated STRING value. I have already sorted by modified time so I want to keep the 1st unique instance.

I have tried writing expressions but have not been able to create anything that would run

1

There are 1 best solutions below

1
Matija Herceg On BEST ANSWER

This expression will give you row_numbers starting from 1 for each WORKORDER_ID. After that you just need to add a filter to only keep the rows where row_number is 1.

row_number() OVER (
PARTITION BY "WORKORDER_ID"
ORDER BY "modified_time" ASC
)

Code in the contour expression board