Forum

Power Query Date Ra...
 
Notifications
Clear all

Power Query Date Range - Between Two Dates

2 Posts
2 Users
0 Reactions
446 Views
 jws
(@jws)
Posts: 1
New Member
Topic starter
 
Hello,

I am having trouble with logic on this on a function where I am trying to create a rolling history file with a rolling date range.

Basically I am taking today's date and my goal is:
1) Pull data 60 days ago (which works) - but where my problem is, I am trying to add an "AND" statement that limits to Today - 40 days)

This works
= Table.SelectRows(#"Changed Type", each [DATE] > Date.AddDays(Date.From(DateTime.LocalNow()),-60))

Using June 1st as the date goal is to return data from 4/2/20 thru 4/22/20

4/2/20 = (-60 days from today)
4/22/20 = (-40 days from today)

I don't want to use actual dates since this will be a rolling file. If this is unclear let me know, thanks for reading.

 
 
 
Posted : 03/06/2020 10:12 am
(@catalinb)
Posts: 1937
Member Admin
 

Something like this?

= Table.SelectRows(#"Changed Type", each

([DATE] > Date.AddDays(Date.From(DateTime.LocalNow()),-60))

and

([DATE] < Date.AddDays(Date.From(DateTime.LocalNow()),-40))

)

 
Posted : 03/06/2020 11:57 pm
Share: