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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
kristi_in_heels
Helper II
Helper II

Relative Date Filter to include any dates in the past plus next 3 months

Hello,

 

I need to apply a filter to a column, so that the results pull any dates in the past, plus the next 3 months. The relative filter works for the 3 month component, however I'm unsure how to also pull anything that is in the past into this list.

 

Is there a measure that could be written that I can apply as a filter instead of using the relative date?

 

Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @kristi_in_heels ,

 

You might want to consider creating a new calculated column by subtracting 3 months from all the dates. Once you have this new column, you can apply a filter to retrieve all records where the new date is prior to today. This way, you will effectively get all the original dates that fall within the past three months.I'v made a test for your reference:

 

1\ I assume there is a table

vbofengmsft_1-1729478816354.png

2\Add a new caculate column

vbofengmsft_2-1729478839997.png

NewDate = EDATE('Table'[ExecutionStartDate],-3)

3\Filter on NewDate

vbofengmsft_3-1729478898299.png

 

Best Regards,

Bof

 

View solution in original post

7 REPLIES 7
divyed
Super User
Super User

Hello @kristi_in_heels ,

 

Assuming you have  a slicers on date , You can use below dax to achieve your purpose :

 

// Slicer takes a value Date from table Dates 

 

1. If you want relative date as selected date + 90 days , use

    

Relative_Date =
SELECTEDVALUE(Dates[Date]) + 90   // assuming 
 
2. if you want relative date as selected date + number of month, use 
   
   Relative_Date 1 = EDATE(SELECTEDVALUE(Dates[Date]), 3)
 
You can replace number if days or months as per need, I would sugget to use parameter if required.
 
divyed_0-1729491152348.png

 

 
I hope this helps. 
 
Please mark this as solution if this works. 
 
Cheers
 
 
LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/
Anonymous
Not applicable

Hi @kristi_in_heels ,

 

You might want to consider creating a new calculated column by subtracting 3 months from all the dates. Once you have this new column, you can apply a filter to retrieve all records where the new date is prior to today. This way, you will effectively get all the original dates that fall within the past three months.I'v made a test for your reference:

 

1\ I assume there is a table

vbofengmsft_1-1729478816354.png

2\Add a new caculate column

vbofengmsft_2-1729478839997.png

NewDate = EDATE('Table'[ExecutionStartDate],-3)

3\Filter on NewDate

vbofengmsft_3-1729478898299.png

 

Best Regards,

Bof

 

Thank you. Some of our dates are in excess of 12 months in the past, would this -3mo calculation still work?
Anonymous
Not applicable

Hi @kristi_in_heels ,

 

Yes. You could adjust the date range according to your specific needs. In the screenshot I provided, the time range is set to include data from the past 10 years.

 

vbofengmsft_0-1729488806415.png

 

Best Regards,

Bof

 

Thanks so much.

 

Would you be able to assist me in tweaking this measure so I can use it to apply a conditional format?

 

Currently, I use this to highlight anything in "FS" phase, but I need the highlight to apply to that same condition for anything in "FS", "PFS" or "CON".

 

TG EXE Before Today = if(max('All Projects'[ProjectPhaseDescription])="FS"&& max('All Projects'[ExecutionStartDate_Forecast])<TODAY(),"#d64550")
vicky_
Super User
Super User

Are you looking for a solution in PowerQuery (M) or in PowerBI (DAX)?

 

Power query actually does have a filter for "In the next"... from which you can set to 3 months. Right click on the column, and you should see it. I don't remember off the top of my head whether those 3 months are months or calendar months, but you should be able to easily tweak the formula (i.e by using days)

vicky__0-1729126242853.png

 

If you're after a DAX solution, I would recommend one of two ways - 
the first would be to not use a calculated column unless absolutely necessary. Instead, consider using calculate functions such as DATESBETWEEN(), DATESINPERIOD() etc... to filter out the dates as needed.

 

If you absolutely need to use a calculated column, then something like:

Flag in Past or next 3 Months = INT(Table[Date] <= EOMONTH(TODAY(), 3))

note that EOMONTH will give you the end of the calendar month, so again, please tweak as needed.

 

Hope this is helpful

Thank you.

 

I am already using the filter for the next 3 months, but this cuts off anything that is noted as before today's date.

 

What I want to see is anything within this filter, PLUS anything that has a date showing prior to today, so we can see items which haven't hit the target date.

 

kristi_in_heels_0-1729128858252.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors