Power BI: load data based on date (month, year, etc.)

When I create a new dashboard and if I don’t need the full data, I like to load data for only some years, it can be:

  • Last year and this year
  • 2 years ago
  • 3 years ago and the current year
  • Etc.

Of course, except the date, I can filter other conditions to reduce the size of my data (read this optional article Power BI: filter before loading data). So in the Power Query Editor, I have those options (left picture) and I will load only data from the last year (right picture):

power bi power bi

As you can see in the left picture, I could choose to filter by quarters, by days, by minutes, etc. On the right picture, I will always load 2 years of data in an automatic way but one of the missing things is an “explicit” option to load data of the previous 2 full year or more.

Choosing again “is in year”, I have those choices:

power bi

None are 2 years ago for instance. Same thing for the other options. I can use “is after” or “is after or equal to” and put the year I want:

power bi

But in this case, Power BI will always load data from this date and in the future, if I need to reduce the size of my data again, I have to change it manually. For an automatic update, I will use “is in the previous”:

power bi

Using only this option, I will have only data of the last 2 years which doesn’t include the current year, to remediate it, I will add the “is in year” one like that:

power bi

What about 18 months with this option ? In this case, I will get only the last 18 months and to include the current month, I will add the “is in month = this month”:

power bi

Same logic applies for the other selections of “is in the previous”.

Interesting Topics