cancel
Showing results for 
Search instead for 
Did you mean: 
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

= 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 work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


View solution in original post

3 REPLIES 3
mwegener
Super User
Super User

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 work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


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

= 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 work at KUMAVISION AG , one of the world's largest
implementation partners for Microsoft Dynamics. #
"Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website


Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors