I'm trying to think of the best way to accomplish this. I already asked about ranks, but then realized I really need rolling ranks.
This is what I currently have.
SELECT distinct *, (dense_rank() over (order by [Year]) - 1) / 3 + 1 as [group] FROM dwmy
As you can see, it's static. It should group by 3 years. When a new year starts, the oldest year would fall off the first page (but still be visible in the report).
So, in the current year, it would look like:
The old groupings would still be on older pages, so users could still see the old groupings of 2019, 2020, 2021 and 2020, 2021, 2022.
Does anyone know an easy way to accomplish this? Thank you.