Forum Discussion
F_Reh
Post Patron
5 months agoDynamically adjusting Graph's Legend to compare past two years
Good Afternoon, I have a graph as this: Currently, I am using the Filter pane to manually restrict the data to 2024 & 2025 only. The Y-Axis is essentially using a measure for Total M...
- 5 months ago
Add a column onto your date table, you could add a calculated column in DAX like
Current or Previous Year = 'Date'[Year] = YEAR ( TODAY () ) || 'Date'[Year] = YEAR ( TODAY () ) - 1or could do the same thing in Power Query or SQL.
Use that column as a filter on the chart visual.
- 5 months ago
Create a calculated column in your Date table for relative year label
Is Rolling 2 Years = IF ( 'Date'[Year] >= YEAR ( TODAY () ) - 1 && 'Date'[Year] <= YEAR ( TODAY () ), 1, 0 )Then in the visual, add Is Rolling 2 Years to Filters on this visual and set it to is 1. Done. Updates automatically every year with no maintenance needed.
cengizhanarslan
Super User
5 months agoCreate a calculated column in your Date table for relative year label
Is Rolling 2 Years =
IF (
'Date'[Year] >= YEAR ( TODAY () ) - 1
&& 'Date'[Year] <= YEAR ( TODAY () ),
1,
0
)
Then in the visual, add Is Rolling 2 Years to Filters on this visual and set it to is 1. Done. Updates automatically every year with no maintenance needed.