'KQL remove from the output strings which have a duplicated value in one of the columns

Let's say I have a table with records about users who had passed certain doors.

I want to remove from the output all strings with records about users that passed 1st door if there is a record about them passing the 2nd door.

summarise by distinct could not be used because I need to keep Timestamp. enter image description here

PS In reality, the event registration time differs by thousandths of a second. That's I don't want to use only the later events. It seems to me more correct is to leave only the record with an event of the first type if there is an event of the second type.

kql


Solution 1:[1]

datatable(Name:string,Source:string,Timestamp:timespan)
[
    'Jack', '1StDoor', '1:01'
   ,'Jill', '1StDoor', '1:02'
   ,'Jill', '2ndDoor', '1:03'
   ,'Mike', '1StDoor', '1:04'
   ,'John', '1StDoor', '1:05'
   ,'John', '2ndDoor', '1:06'
]
| summarize arg_max(Source, *) by Name
Name Source Timestamp
Jack 1StDoor 01:01:00
Jill 2ndDoor 01:03:00
Mike 1StDoor 01:04:00
John 2ndDoor 01:06:00

Fiddle

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David דודו Markovitz