I have a query, which I'd like to filter by the new date column I created.
Basically, anything which is 42 days earlier than that date is accepted.
I've tried doing a filter by date, and then substracting it by 42, but it does not work?
let
#"SQL-JM" = let
Source = Sql.Databases("xxx.xxx.xxx.xxx"),
MNH = Source{[Name="DBT"]}[Data],
#"DBO-JM" = DBT{[Schema="dbo",Item="DBO-JM"]}[Data]
in
#"DBO-JM",
#"Added Custom1" = Table.AddColumn(#"DBO-JM", "Start_of_QTR", each Date.StartOfQuarter(DateTime.LocalNow())),
in
#"Filtered Rows"
If I understand your task correctly, you don't need custom column at all.
I'd do like that:
let
#"SQL-JM" = let
Source = Sql.Databases("xxx.xxx.xxx.xxx"),
MNH = Source{[Name="DBT"]}[Data],
#"DBO-JM" = DBT{[Schema="dbo",Item="DBO-JM"]}[Data],
GetFilterDate = Date.From(Date.StartOfQuarter(DateTime.LocalNow())), //You can use any logic to get that date
FilterRows = Table.SelectRows(#"DBO-JM", each [DateStamp] < GetFilterDate) //You can also add some modifications to GetFilterDate using each row's values, if you need
in
FilterRows