Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
F_Reh
Post Patron
Post Patron

Dynamically adjusting Graph's Legend to compare past two years

Good Afternoon,

 

I have a graph as this:

 

F_Reh_0-1776689558560.png

 

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 Meetings.

 

Now, I need to have the graph to be updated so only 2025 & 2026 are showing. Plainly, I'd prefer not to have to manually adjust this every year.

 

Kindly advise on the best approach to handle this matter.

 

 

 

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

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 () ) - 1

or could do the same thing in Power Query or SQL.

Use that column as a filter on the chart visual.

View solution in original post

cengizhanarslan
Super User
Super User

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.

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

View solution in original post

2 REPLIES 2
cengizhanarslan
Super User
Super User

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.

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.
johnt75
Super User
Super User

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 () ) - 1

or could do the same thing in Power Query or SQL.

Use that column as a filter on the chart visual.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.