Let's say I have a table like this:
| Person | Entrance | Exit |
|---|---|---|
| One | 09.08.2022 | |
| One | 10.08.2022 | |
| One | 10.08.2022 | |
| One | 13.08.2022 | |
| Two | 08.08.2022 | |
| Two | 12.08.2022 |
I want to end up with 3 rows like these:
| Person | Entrance | Exit |
|---|---|---|
| One | 09.08.2022 | 10.08.2022 |
| One | 10.08.2022 | 13.08.2022 |
| Two | 08.08.2022 | 12.08.2022 |
I guess I can do it with a Lag function. But what is the correct way of doing this? Thanks in advance.
Supposing that each entrance date has an exit date, you may try the following:
See a demo.