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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Zedders12345
New Member

Date is NOT within previous N months

Hi everyone 

 

Im using power query to manipulate some data and i wand to date filer where a date is NOT within the previous N months.  There is and option to filter if it IS within previous months but it isnt clear ho to request the opposite

 

Any help would be very much appreciated 

 

Thank you 

1 REPLY 1
Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Zedders12345 - the Date.IsInPreviousMonths function is logical so it returns true/false, so you simply need to add "not" before the function to change from true (in previous months) to false.  However, the function could return future dates, so it is best to exclude these.


//Return rows before and after the previous 3 months
Table.SelectRows(Source, each not Date.IsInPreviousNMonths([Date], 3))

//Return rows before and after the previous 3 months
Table.SelectRows(Source, each not Date.IsInPreviousNMonths([Date], 3) 
and [Date] < Date.From(DateTime.FixedLocalNow()) )

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.