cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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 - podcast


View solution in original post

3 REPLIES 3

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 - podcast


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 - podcast


Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.