Jul 26 2019 08:16 AM
Anyone here know of a way I can put a function into the value of the date field that makes it check for the upcoming Wednesday and the Wednesday after that. Since I built this one Tuesday that made it 7/24 and 7/31.
Thanks!
Jul 26 2019 08:59 AM
@Ghostey ,
You may apply your filter with dates using calendar, after that in Advanced editor change this step on something like
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
// #"Filtered Rows" = Table.SelectRows(Source, each [StartDate] > #date(2019, 7, 31) and [StartDate] < #date(2019, 8, 7))
#"Filtered Rows" = Table.SelectRows(
Source,
each
[StartDate] > Date.AddDays(Date.StartOfWeek(DateTime.LocalNow(),Day.Wednesday),7) and
[StartDate] < Date.AddDays(Date.StartOfWeek(DateTime.LocalNow(),Day.Wednesday),14)
)
in
#"Filtered Rows"
It is assumed [StartDate] is in datetime format and we ignore time of the day. If not, bit more adjustments are required.
Jul 26 2019 09:39 AM
THANKS!! This is almost perfect. What adjustment can I make so I can include a time. My field is a Date / Time where for the Start Date I need it to be 9:15:00 AM on the upcoming and 9:14:59 AM on the second.
Jul 26 2019 10:46 AM
You may add #duration, parameters are days, hours, minutes, seconds, as
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
// #"Filtered Rows" = Table.SelectRows(PrevStep, each [StartDate] > #date(2019, 7, 31) and [StartDate] < #date(2019, 8, 7))
#"Filtered Rows" = Table.SelectRows(
Source,
each
[StartDate] >
Date.AddDays(Date.StartOfWeek(DateTime.LocalNow(),Day.Wednesday),7) +
#duration(0,9,15,0) and
[StartDate] <
Date.AddDays(Date.StartOfWeek(DateTime.LocalNow(),Day.Wednesday),14) +
#duration(0,9,14,59)
)
in
#"Filtered Rows"
Exact seconds in duration depends on do you use > / < or <= / <=