'How to plot previous and current year monthly data in the last 6 months in Power BI?

I'm trying to plot the previous and current year monthly data for Oct 2021 to Mar 2022 (last 6 months). I have created a measure to calculate previous year data and managed to obtained the current and previous year data for my desired range (Oct 2021 to Mar 2021) if I set my date filter range from 1 Oct 2020 to 31 Mar 2022. However, my bar chart is now displaying the entire filter range (1 Oct 2020 to 31 Mar 2022) instead of my desired range, and data before Oct 2021 is only showing current year while data after Mar 2022 only shows previous year data. If I limit my filter range to the desired range (Oct 2021 to Mar 2022), my chart will only display either current year data.

Unfortunately, I'm unable to attach my chart in this comment. Hope I have described my problem well.

Following is the measure for previous year data I have used: Previous Year Demand = Calculate(SystemResult[Current Year Demand],dateadd('Date Table'[Date].[Date],-1,YEAR))



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source