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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.