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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
murali5431
Helper III
Helper III

Removal of rows having date 30 days before latest date using Power query

Hi,

 

I have  package information as below with their dates

 

PackageDate
ABCD12341-Sep-21
null1-Sep-21
ABCD12341-Sep-21
ABCD12349-Oct-21
ABCD12341-Oct-21
null10-Oct-21
ABCD12349-Oct-21
null10-Oct-21
null10-Oct-21
ABCD123410-Oct-21
MNOP567815-Sep-21
MNOP567820-Oct-21
null15-Sep-21
MNOP56781-Oct-21
MNOP567810-Oct-21
MNOP567810-Oct-21
null10-Oct-21
MNOP56781-Oct-21
null10-Oct-21
null10-Oct-21
MNOP567815-Sep-21
MNOP567810-Oct-21

 

I need assistance with how I can remove rows that are older than 30 days from current date (Current date - date in table > 30 should be deleted) while retaining null value rows, in Power query.

 

Thanks in advance!

Regards,

Muralidhar

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

= Table.SelectRows(#"Changed Type1", each [Package] = null or [Date] > Date.AddDays(DateTime.Date(DateTime.FixedLocalNow()),-30))
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

3 REPLIES 3
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @murali5431 

 

this should work

= Table.SelectRows(#"Changed Type1", each [Date] > Date.AddDays(DateTime.Date(DateTime.FixedLocalNow()),-30))

 

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Thank you @mwegener 

 

Can you let me know how to retain the rows having "null" in column A. I believe that was not considered in the above query

mwegener
Most Valuable Professional
Most Valuable Professional

= Table.SelectRows(#"Changed Type1", each [Package] = null or [Date] > Date.AddDays(DateTime.Date(DateTime.FixedLocalNow()),-30))
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.