Date.IsInPreviousYear

Product:
Microsoft Power BI desktop

Issue:

How select all data from a year, when you have a date column in your table?

Solution:

Inside PowerBI you can enter formulas like this;

to select last year

= Table.SelectRows(#"Changed Type1", each Date.IsInPreviousYear([Datum]))

 

to select specific year

= Table.SelectRows(#"Changed Type1", each Date.Year([Datum])=2022)

 

to select all dates before 2022


= Table.SelectRows(#"Changed Type1", each [Datum] < #date(2022, 1, 1))

 

 

More Information:

https://learn.microsoft.com/en-us/powerquery-m/date-isinpreviousyear

How to Calculate Year to Date and Prior YTD in Power BI

https://thedatalabs.org/how-to-get-the-same-period-last-year-to-date-in-power-bi/