I have below data set. I have created a flag as 0 and -1. Now
i have to generate sequence as shown in output column where if you group by columnA, then group by column B and Column C is 'Y' and flag is 0 then next row should be 1, and so on. Similarly if flag is -1 then row wise I have to create negative sequence.
A | B | C | Date | Flags |
a | q | N | 4/30/2020 | Null |
a | q | N | 5/31/2020 | -1 |
a | p | Y | 6/30/2020 | 0 |
a | p | Y | 3/31/2022 | Null |
b | t | N | 7/31/2020 | Null |
b | t | N | 8/31/2020 | Null |
b | t | N | 9/30/2020 | Null |
b | t | N | 10/31/2020 | -1 |
b | s | Y | 11/30/2020 | 0 |
b | s | Y | 12/31/2020 | Null |
b | s | Y | 1/31/2021 | Null |
Output:
A | B | C | Date | Flags | Output |
a | q | N | 4/30/2020 | Null | -2 |
a | q | N | 5/31/2020 | -1 | -1 |
a | p | Y | 6/30/2020 | 0 | 0 |
a | p | Y | 3/31/2022 | Null | 1 |
b | t | N | 7/31/2020 | Null | -4 |
b | t | N | 8/31/2020 | Null | -3 |
b | t | N | 9/30/2020 | Null | -2 |
b | t | N | 10/31/2020 | -1 | -1 |
b | s | Y | 11/30/2020 | 0 | 0 |
b | s | Y | 12/31/2020 | Null | 1 |
b | s | Y | 1/31/2021 | Null | 2 |
Hi,@PB41091
I made a similar post a few days ago with a solution. ( the flow is group by column A, so you can group column B or C as your need. )
will you share your workflow?