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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply

Filter Date Column

I am looking to filter my data and display data for dates that are greater than of equal to 3 months prior (starting the first day of the month) or equal today.  I'm not sure if the power query supports this filter.  Should this be done on the in advance editor? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @istduncan-cohp 

 

You can click the fx beside the formula bar above the table to add a custom step, then paste the following code in the formula bar. Replace "previous step" accordingly. 

= Table.SelectRows(#"previous step", each Date.IsInPreviousNMonths([Date], 3) or (Date.IsInCurrentMonth([Date]) and [Date] <= DateTime.Date(DateTime.LocalNow())))

vjingzhanmsft_0-1710470849952.png

Another code

= Table.SelectRows(#"previous step", each [Date] >= Date.StartOfMonth(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),-3)) and [Date] <= DateTime.Date(DateTime.LocalNow()))

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @istduncan-cohp 

 

You can click the fx beside the formula bar above the table to add a custom step, then paste the following code in the formula bar. Replace "previous step" accordingly. 

= Table.SelectRows(#"previous step", each Date.IsInPreviousNMonths([Date], 3) or (Date.IsInCurrentMonth([Date]) and [Date] <= DateTime.Date(DateTime.LocalNow())))

vjingzhanmsft_0-1710470849952.png

Another code

= Table.SelectRows(#"previous step", each [Date] >= Date.StartOfMonth(Date.AddMonths(DateTime.Date(DateTime.LocalNow()),-3)) and [Date] <= DateTime.Date(DateTime.LocalNow()))

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.