SQL query to create list of values for past 24 months
Summary: I've been searching and attempting to create a List of Values to be used in a Data Model for a report to make the parameter selection dynamic year over year instead of having to manually add the current/new year and remove the oldest year. Although this may not be the best approach, I've been trying to get current year through using sysdate, then attempting to build the query with values for current and previous years (only showing 2 years or 24 months).
Content (please ensure you mask any confidential information):
For example, with this year being 2025 we would need to populate the list of values with all months for 2025 and 2024 with the associated values. In the image below, I didn't capture all the 2025 months in the screenshot due to the list being long and hope this provides a good representation of the end goal.