Trailing three years filter

The objective of this example is to retrieve dates from three years prior to the current year through the current date. For example, on October 18th, 2017, the query should retrieve January 1st, 2014 through October 18th, 2017. This requirement ensures that three full years of historical data, plus the current year, is always available to support reporting.

The starting date and current date values for the filter condition are computed via Date and DateTime M functions and assigned variables names (StartDate, CurrentDate). Since the starting date will always be on January 1st, it's only necessary to compute the starting year and pass this value to the #date constructor. Finally, the two date variables are passed ...

Get Mastering Microsoft Power BI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.