Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello,
I have two data tables in PowerBI. One of them is called as calendar which has nothing but the names of the 12 months and the second is shown below.
Month | Year | Value |
Jan | 2023 | 386 |
Feb | 2023 | 82391 |
Mar | 2023 | 3489 |
Apr | 2023 | 348 |
May | 2023 | 23894 |
Jun | 2023 | 32498 |
Jul | 2023 | 389 |
Aug | 2023 | 23489 |
Sept | 2023 | 2348 |
Oct | 2023 | 32498 |
Nov | 2023 | 38924 |
Dec | 2023 | 3289 |
Jan | 2024 | 24390 |
I have created a relation between the two months columns with the month column from the calendar table on x-axis and in the filter pane. The filter pane has another filter called Year from the second data table
.
I have created two measures as following
Current Year = VAR SelectedYear = SELECTEDVALUE(‘Values’[Year], BLANK())
RETURN
CALCULATE(SUM(‘Values’[Value], ‘Values’[Year] = SelectedYear)
Previous Year = VAR SelectedYear = SELECTEDVALUE(‘Values’[Year], BLANK()) - 1
RETURN
CALCULATE(SUM(‘Values’[Value], ‘Values’[Year] = SelectedYear)
I have placed both the measures on the Y-Axis with all the months checked on the filter pane but when the chart is being generated, its only plotting the values for Jan for both the years instead of plotting it for all the months for 2023. Any help regarding the same would be really appreciated. Thank you
Solved! Go to Solution.
Hi @BIUser1998 ,
I filled in the sample data and made up 24 years of data, and the result should be what you want, please check again.
And you can see below, there's no year field in Legend.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @BIUser1998 ,
Thank you for reaching us. As far as I understand, you need a chart to show the year you currently selected, and the previous year. Then you should modify the measure to:
Previous Year = VAR SelectedYear = SELECTEDVALUE('Values'[Year], BLANK())-1
RETURN
CALCULATE(SUM('Values'[Value]),FILTER(ALLEXCEPT('Values','Values'[Month]),[Year]=SelectedYear))
You can download my attachment for more details.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous , thank you for your reply.
I need it to look something like this
Unfortunately, because I'm using data from other tables as well on this particular chart, I cannot just drag the Year field into legend to get a breakdown of year which is why I'm resorting to creating two measures with the data available. Thank you for your help
Hi @BIUser1998 ,
I filled in the sample data and made up 24 years of data, and the result should be what you want, please check again.
And you can see below, there's no year field in Legend.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.