Forum Discussion
Anonymous
4 years agoNot applicable
Get data for the last X days including today
I am trying to get data for the past 7 days including today I have tried in the previous 7 days and selecting 'today' (see img) but the next day it does not dynamically change. The reason I am using...
Rickmaurinus
Helper V
2 years agoUnfortunately Date.IsInPreviousNDays does not include the date of today. The image on this page illustrates this: https://powerquery.how/date-isinpreviousndays/
You could use:
Table.SelectRows(
Source,
each [datetime] >= Date.AddDays( DateTime.LocalNow(), -7 )
and [datetime] <= DateTime.LocalNow()
)Notice that even if you subtract days from a datetime value, the output is still a datetime value (https://powerquery.how/date-adddays/).
--------------------------------------------------
@ me in replies or I'll lose your thread
Master Power Query M? -> https://powerquery.how
Read in-depth articles? -> BI Gorilla
Youtube Channel: BI Gorilla
If this post helps, then please consider accepting it as the solution to help other members find it more quickly.