I have a weird snowflake table format which is causing issues when showing last 36 months of data only.
in words, i want to see last 36 months of data so when looking at current date, everything before May 2021 should show as 0.
The fiscal year starts from Oct hence the table months are shifted.
The years go further than 2021 but i only want last 36 months.
the platform is snowflake script but if you have a sql script i can translate to snowflake as well.
any advice would be appreciated.
Original Table im starting with:
| Account | Year | Oct |Nov|Dec|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|
|———————|——————|—————–|—|—|—|—|—|—|—|—|—|—|—|
| A1 | 2021 |1|2|3|4|5|6|44|55|66|77|88|99|
| A2 | 2022 |1|2|3|4|5|6|44|55|66|77|88|99|
|A3|2023|1|2|3|4|5|6|44|55|66|77|88|99|
|A4|2024|1|2|3|4|5|6|
The result table im struggling to get:
| Account | Year | Oct |Nov|Dec|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|
|———————|——————|—————–|—|—|—|—|—|—|—|—|—|—|—|
| A1 | 2021 |0|0|0|0|0|0|0|55|66|77|88|99|
| A2 | 2022 |1|2|3|4|5|6|44|55|66|77|88|99|
|A3|2023|1|2|3|4|5|6|44|55|66|77|88|99|
|A4|2024|1|2|3|4|5|6|7|