I have a table as below and want to fill down the Stage of the same category based on the condition
if Stage = "Delivered" then fill down "Delivered" to all the next rows else if Stage = "Paid" then fill down "Paid" to all the next rows
Category | Date | Stage |
---|---|---|
A | 2021-11-01 | Ordered |
A | 2021-12-01 | Paid |
A | 2022-01-01 | |
B | 2021-08-01 | |
B | 2021-09-01 | Ordered |
B | 2021-10-01 | Paid |
B | 2021-11-01 | Ordered |
B | 2021-12-01 | Delivered |
The result should look like:
Category | Date | Stage |
---|---|---|
A | 2021-11-01 | Ordered |
A | 2021-12-01 | Paid |
A | 2022-01-01 | Paid |
B | 2021-08-01 | |
B | 2021-09-01 | Ordered |
B | 2021-10-01 | Paid |
B | 2021-11-01 | Paid |
B | 2021-12-01 | Delivered |
Could anyone help? I would really appreciate it!