Forum Discussion
aatish178
2 years agoHelper IV
Filtering date column data in power query
Hi All, I want to filter a date column to only show last 3 years of data from today's date in power query. The filtering should be from today's date and it would be dynamic after every day. Can you...
- 2 years ago
I don't think you can do that in Power Query. I believe you will need to load the entire data set, and then filter. M-code would be something like:
Table.SelectRows(#"Previous Step", each [date_column_to_filter_on] > Date.AddYears(Date.From(DateTime.FixedLocalNow()),-3))If you only want to LOAD the past three years, that would need to be done either at the data source, or, depending on the data source, perhaps in your connector (eg if it involves an api perhaps there is an argument to restrict the data).
aatish178
2 years agoHelper IV
Hi, thanks for the reply...
I want to load only last 3 years of data from today's date
So basically it would be like Date>=last 3 years of date from today
lbendlin
2 years agoSuper User
I want to load only last 3 years of data from today's date
So basically it would be like Date>=last 3 years of date from today
That's still ambiguous. Including or excluding "today" from three years back?