Filter a column from earliest date in a column to 700 days out --- Power Query

Plukey

Board Regular
Joined
Apr 19, 2019
Messages
138
Office Version
  1. 2016
Platform
  1. Windows
Ive been asked (not sure if this can even be done) filter a Date column 700 days from the earliest date in the column The Date column has work due from now 2021 - 2025. I did a filter listed below. Ideally, im looking for somthing more automatic.

SQL:
= Table.SelectRows(#"Promoted Headers", each [#"PLN-BD SchFin"] >= #date(2019, 11, 1) and [#"PLN-BD SchFin"] <= #date(2024, 4, 30))
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
try

Power Query:
= let maxdt = Date.AddDays(List.Min(#"Promoted Headers"[#"PLN-BD SchFin"]),700) in Table.SelectRows(#"Promoted Headers", each [#"PLN-BD SchFin"]<= maxdt)
 
Upvote 0
Solution
Thank you, I copied and placed your line in the advance editor and its a no go got a bunch of errors... my column starts 11/29/2021 and ends 4/29/2024 which is roughly 700 days out...but the data will increase further out very soon.
 
Upvote 0
Ive tried this and notta.

SQL:
= Table.SelectRows(#"Promoted Headers", let earliest = List.Min(#"Promoted Headers"[PLN ActFin]) in each [PLN ActFin] = earliest) and(#"Promoted Headers", each Date.IsInNextNDays([PLN ActFin], 700))
 
Upvote 0
It's not going to work pasting that into the advanced editor; you would need to paste something like this under the #"Promoted Headers" step.

Power Query:
FilterStep =  let maxdt = Date.AddDays(List.Min(#"Promoted Headers"[#"PLN-BD SchFin"]),700) in Table.SelectRows(#"Promoted Headers", each [#"PLN-BD SchFin"]<= maxdt)
 
Upvote 0
It's not going to work pasting that into the advanced editor; you would need to paste something like this under the #"Promoted Headers" step.

Power Query:
FilterStep =  let maxdt = Date.AddDays(List.Min(#"Promoted Headers"[#"PLN-BD SchFin"]),700) in Table.SelectRows(#"Promoted Headers", each [#"PLN-BD SchFin"]<= maxdt)
Perfect, thank you!
 
Upvote 0
It was late & I thought it worked, but unfortunately its not. I placed the line under Promoted headers .
1654165161913.png

1654165176378.png
 
Upvote 0
SQL:
= Table.SelectRows(#"Promoted Headers", let earliest = List.Min(#"Promoted Headers"[#"PLN-BD SchFin"]) in each [#"PLN-BD SchFin"] = earliest or Date.IsInNextNDays([#"PLN-BD SchFin"], 675))

I did this using the filter, kinda works but leaves out 5 months, i cant figure out how to use the DateAdd.days
 
Upvote 0
In the user interface paste it as in post #2

In advanced editor paste it as in post #5
 
Upvote 0
Pasted in the user interface as in Post#2 &

And Post#5 in advance editor got (Token Eof expected)

Apologies, i feel that I'm struggling on this
1654177788596.png
 
Upvote 0

Forum statistics

Threads
1,223,661
Messages
6,173,647
Members
452,525
Latest member
DPOLKADOT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top