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):
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:
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:
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”:
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:
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”:
Same logic applies for the other selections of “is in the previous”.
Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...