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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Dynamic Relative Date Filtering

Hi,

 

One of my go to features is creating a calculated column in my Date dimension to show my the Offset of months from the current month. So:

 

= DATEDIFF(TODAY(), DateTable[Date], MONTH)

 

Which will say October =0, September = -1, August = -2 and so on.

 

And it's great. I can pop it into a visual level filter and do less than or equal to 0 and greater or equal to -5 and it will give me the last 5 full months + the current incomplete month. Soemthing I believe relative date filtering can't do unless I'm mistaken.

 

 

However I'm wondering how easy it would be to replicate this but where the selected month always equals 0. So if I have a filter on the report for Month and the user selects March, then March becomes the "0" in this above instance and everything shifts back from there. So I could select a rolling 15 months for example and whenever a certain month is selected, it always shows the previous 15 months from that point.

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous,

 

Although this is a good workaround for the rolling months, this is not the best approach for this.

 

Check the blog below where you have an example of selecting the month and the N months you want to have displayed on your charts and this works with filter of dates.

 

http://sqljason.com/2018/03/display-last-n-months-selected-month-using-single-date-dimension-in-powe...

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @Anonymous,

 

Although this is a good workaround for the rolling months, this is not the best approach for this.

 

Check the blog below where you have an example of selecting the month and the N months you want to have displayed on your charts and this works with filter of dates.

 

http://sqljason.com/2018/03/display-last-n-months-selected-month-using-single-date-dimension-in-powe...

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Anonymous
Not applicable

Hi @MFelix, this is perfect thanks!

 

I suppose my next issue which I didn't mention is that the calculation I'm looking to roll back 13 months is a YTD calculation. So it only starts from this year. Think I need to amend my DAX calculation but that has certainly helped my issue

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors