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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ironboy0418
Helper II
Helper II

How can we limit the rows by date column using Power Query Advanced Editor?

I have more than 1 million rows of data and the objective is to limit it only for the past 2 years. Is it possible to do it in Power Query Advanced editor?

7 REPLIES 7
FreemanZ
Super User
Super User

hi @ironboy0418 

you can filter the column

FreemanZ_0-1677755794854.pngFreemanZ_1-1677755833883.png

 

thanks @FreemanZ 🙂 Is there a way to filter it by using Power Query M Language? My objective is to filter only the data for the past 2 years. Ex. Date>= January 1, 2022 and Date <= Yesterday?

hi @ironboy0418 

= Table.SelectRows(#"Filtered Rows4", each Date.IsInPreviousNYears([Date], 2))

Thanks for this! @FreemanZ However, it returns only the year 2022:

ironboy0418_0-1677759390755.png

 

Saw this @FreemanZ but I'm getting error incorporating it in your formula above:

ironboy0418_0-1677759758959.png

 

hi @ironboy0418 

do you have data older than 2 year?

vast majority of the processing in Power Query is done with mouse clicks, why bother writing code?

@FreemanZ yup however I can't even return the data for 2023 by using date filters in columns

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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