Hi everyone,
I have the below data and I need to filter the data basis below conditions:
- If Status = Completed then I need the first record of that Name
- For every other status I need the last record of that Name
Data:
| ID | Name | Status |
| 1 | A | Open |
| 2 | A | Open |
| 3 | A | Open |
| 4 | A | In Progress |
| 5 | A | In Progress |
| 6 | A | Completed |
| 7 | A | Completed |
| 8 | A | Completed |
| 9 | B | Open |
| 10 | B | Open |
| 11 | B | Open |
| 12 | B | In Progress |
| 13 | B | In Progress |
| 14 | C | Open |
| 15 | C | Open |
| 16 | C | Open |
| 17 | D | Open |
| 18 | D | Open |
| 19 | D | In Progress |
| 20 | D | In Progress |
| 21 | D | Open |
Output required:
| ID | Name | Status |
| 6 | A | Completed |
| 13 | B | In Progress |
| 16 | C | Open |
| 21 | D | Open |