You have a parameter like `today` and you want to easily add and substrate days from that... like yesterday is `days_ago(1)`
firstname.lastname@example.org wrote this over 2 years ago and it was last updated over 2 years ago.
Hey if you like my post about how to get todays date in power query m then your like to also want something like a function that allows you to easily add or substract days ago.
In some languages like Ruby this is done like
today - 1.day or
today - 1.days.ago so I have created a function in Power Query M that is just as elegant as this.
So slap this function in your Power Query and pair it with that todays date parameter.
days_ago = (n) =>
date = Date.AddDays(today, -n)
Now you can do stuff like
if Date.From([invoiced_at]) >= DAYSAGO(-7) then
You can also use this to add days by passing a positive value to the function like
DAYSAGO(today, 1) but I'd recommend just having another function called
DAYSAHEAD or something else intuitive so your coding feels more natural and less like speaking in double negatives.