Forum Discussion
pmbaranski
5 years agoFrequent Visitor
Embedding a Case in advanced editor
Hi all, I am trying to modify the below M code to also handle a case where if a column "PrevClose" is True then it will be displayed regardless of what VarToday is. #"Filtered Rows" =...
- 5 years ago
If anyone else is curious, the way i accomplished this is by adding a custom conditional column where PrevClose being True is equal to 1, and then inserting the OR statement like below;
#"Filtered Rows" = Table.SelectRows( #"Added Conditional Column", let varToday = DateTime.Date(DateTime.LocalNow()), varLastDay = if Date.DayOfWeek(varToday) <= 2 then Date.AddDays(varToday, 3) else if Date.DayOfWeek(varToday) >= 3 then Date.AddDays(varToday, 5) else Date.AddDays(varToday, 1) in each [StartDate] <= varLastDay or [Custom] = 1),
pmbaranski
5 years agoFrequent Visitor
If anyone else is curious, the way i accomplished this is by adding a custom conditional column where PrevClose being True is equal to 1, and then inserting the OR statement like below;
#"Filtered Rows" = Table.SelectRows(
#"Added Conditional Column",
let
varToday = DateTime.Date(DateTime.LocalNow()),
varLastDay = if Date.DayOfWeek(varToday) <= 2 then Date.AddDays(varToday, 3) else if Date.DayOfWeek(varToday) >= 3 then Date.AddDays(varToday, 5) else Date.AddDays(varToday, 1)
in
each [StartDate] <= varLastDay or [Custom] = 1),