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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

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