Forum Discussion
Filter by Today’s date in Power Query
- 6 years ago
Hi RaphaelAlves ,
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel= Table.SelectRows(#"Name of Previous Step", each [Column1] = DateTime.LocalNow())
Technically it returns a Date/Time value, where TODAY() returns a Date value. The literal closest to TODAY() is Date.From(DateTime.LocalNow()) which you should use rather than DateTime.LocalNow() alone if the column you're filtering is already a plain date type rather than date/time.
- 6 years ago
Hi RaphaelAlves ,
If your data is date type not date/time one, Then we should use DateTime.Date(DateTime.LocalNow()) to work on it.
Btw, M code for your reference.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQ3NNA3MlaK1YFxDYEIwTUwBCJUrpFSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [DATE = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"DATE", type date}}), #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([DATE] = DateTime.Date(DateTime.LocalNow()))) in #"Filtered Rows"
Hi RaphaelAlves ,
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
= Table.SelectRows(#"Name of Previous Step", each [Column1] = DateTime.LocalNow())
Technically it returns a Date/Time value, where TODAY() returns a Date value. The literal closest to TODAY() is Date.From(DateTime.LocalNow()) which you should use rather than DateTime.LocalNow() alone if the column you're filtering is already a plain date type rather than date/time.
- v-frfei-msft6 years agoCommunity Support
Hi RaphaelAlves ,
If your data is date type not date/time one, Then we should use DateTime.Date(DateTime.LocalNow()) to work on it.
Btw, M code for your reference.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQ3NNA3MlaK1YFxDYEIwTUwBCJUrpFSbCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [DATE = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"DATE", type date}}), #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([DATE] = DateTime.Date(DateTime.LocalNow()))) in #"Filtered Rows"