Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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" = Table.SelectRows(
#"Removed Columns",
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
),
My first though would be to add an OR statement like the below, but it is not behaving as expected.
each [StartDate] <= varLastDay or [PrevClose] ="True"
The end goal of this is to display all jobs due to begin within the next 3 days, including jobs starting at any point in the future if the PrevClose is True.
Solved! Go to Solution.
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),
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),
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.