Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi there, this problem has had me stuck for a little while.
All I'm trying to do is filter the table so that it keeps rows with a date greater than 7 days old. To do so, I'm simply using the [Date] column from the table and comparing it to DateTime.LocalNow()
Previously, I generated a new column and compared the dates that way:
(note: I recognize both functions reference #"Filter Packet Turned In" but it's just a quick recreation of what I had)
However I'm wondering if there is way to avoid generating a new column and instead store the current day as a variable/function that can be referenced. I tried the process below but got the following error:
Appreciate any help!
Solved! Go to Solution.
Something like this (with your own fields):
= Table.SelectRows(#"previous Step", each Duration.Days( Date.From(DateTime.LocalNow()) - [Date] ) > 7)
You can declare a variable if you want to:
let thedate = Date.From(DateTime.LocalNow()) in
Alright so the variable 'thedate' needs to be in it's own let-in environment, seperate (or nested) from the main let-in environment of the query?
Something like this (with your own fields):
= Table.SelectRows(#"previous Step", each Duration.Days( Date.From(DateTime.LocalNow()) - [Date] ) > 7)
Ok so the Date.From(DateTime.LocalNow()) has to be called in the Table function? It can't be stored as its own seperate variable and be called like I showed in my example?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!