I have a table that has an activity date of when things change such as
2020-08-13 123 Upgrade
2020-08-17 123 Downgrade
2020-08-21 123 Upgrade
Basically this in relation to a line there are 3 activities happening on this account. They have a basic account then they downgrade but then they upgrade again
I would like to have these happen in steps such as
2020-08-13 123 Upgrade1
2020-08-14 123 Upgrade1
2020-08-15 123 Upgrade1
2020-08-16 123 Upgrade1
2020-08-17 123 Downgrade1
2020-08-18 123 Downgrade1
2020-08-19 123 Downgrade1
2020-08-20 123 Downgrade1
2020-08-21 123 Upgrade2
.
.
.
2020-09-09 123 Upgrade2
Then I would like to partition them by their activity and see this in the end results so I can calculate how many users stayed in their downgraded state for more than 30 days to see their behavior compared to a upgraded change.
2020-08-13 123 Upgrade1. 1
2020-08-14 123 Upgrade1. 2
2020-08-15 123 Upgrade1. 3
2020-08-16 123 Upgrade1. 4
2020-08-17 123 Downgrade1. 1
2020-08-18 123 Downgrade1. 2
2020-08-19 123 Downgrade1. 3
2020-08-20 123 Downgrade1. 4
2020-08-21 123 Upgrade2. 1
.
.
.
2020-09-09 123 Upgrade2. 18
I have tried doing Coalesce then row_num but I can't wrap my head around how to partition out each activity based on when they changed their account status.