A visual step-by-step guide to forecasting using Power BI.
In this post, we’ll go through the process of creating forecasting in Power BI.
Get the Data
You can download the dataset that I used here. It contains daily female births in California in 1959¹. For a list of other time-series datasets, check out Jason Brownlee’s article 7 Time Series Datasets for Machine Learning – Machine Learning Mastery.
Let’s load the data into Power BI. Open up Power BI and click on “Get data” on the welcome screen as shown below.
Next, you’ll be presented with another pane that asks what type of data we want to get. Select “Text/CSV” as shown below and click on “Connect.”
When the File Open window appears, navigate to where we saved the dataset and click on the “Open” button on the lower right-hand corner.
When a preview appears, just click on “Load.”
We’ll now see the main working area of Power BI. Head over to the “Visualizations” panel and look for “Line Chart.”
This is what the line chart icon looks like:
Next, a visual placeholder will appear. Drag the hot corner marking on the lower right-hand corner of the placeholder and drag it diagonally down and to the right corner of the main working area.
Next, head over the “Fields” panel.
With the line chart placeholder still selected, find the “Date” field and click on the square box to put a checkmark on it.
We’ll now see the “Date” field under Axis. Click on the down arrow on the right of the “Date” as shown below.
Select “Date” instead of the default, “Date Hierarchy.”
Then, let’s put a checkmark on the “Births” field.
We’ll now see a line graph like the one below. Head over the Visualization panel and under the list of icons, find the analytics icon as shown below.
Scroll down the panel and find the “Forecast” section. Click on the down arrow to expand it if necessary.
Next, click on “+Add” to add forecasting on the current visualization.
We’ll now see a solid gray fill area and a line plot to the right of the visualization like the one below.
Let’s change the Forecast length to 31 points. In this case, a data point equals a day so 31 would roughly equate to a month’s worth of predictions. Click on “Apply” on the lower right-corner of the Forecast group to apply the changes.
Instead of points, let’s change the unit of measure to “Months” instead as shown below.
Once we click “Apply,” we’ll see the changes in the visualization. The graph below contains forecast for 3 months.
What if we wanted to compare how the forecast compares to actual data? We can do this with the “Ignore last” setting.
For this example, let’s ignore the last 3 months of the data. Power Bi will then forecast 3 months worth of data using the dataset but ignoring the last 3 months. This way, we can compare the Power BI’s forecasting result with the actual data in the last 3 months of the dataset.
Let’s click on “Apply” when we’redone changing the settings as shown below.
Below, we can see how the Power BI forecasting compares with the actual data. The black solid line represents the forecasting while the blue line represents the actual data.
The solid gray fill on the forecasting represents the confidence interval. The higher its value, the large the area will be. Let’s lower our confidence interval to 75% as shown below and see how it affects the graph.
The solid gray fill became smaller as shown below.
Next, let’s take into account seasonality. Below, let’s set it to 90 points which is equivalent to about 3 months. Putting this value will tell Power BI to look for seasonality within a 3-month cycle. Play with this value with what makes sense according to the data.
The result is show below.
Let’s return our confidence interval to the default value of 95% and scroll down the group to see formatting options.
Let’s change the forecasting line to an orange color and let’s make the gray fill disappear by changing formatting to “None.”
And that’s it! With a few simple clicks of the mouse, we got ourselves a forecast from the dataset.
Thank you for reading. If you want to learn more about my journey from slacker to data scientist, check out the article below:From Slacker to Data ScientistMy journey into data science without a degree.towardsdatascience.com
And if you’re thinking about switching gears and venture into data science, start thinking about rebranding now:The Slacker’s Guide to Rebranding Yourself as a Data ScientistOpinionated advice for the rest of us. Love of math, optional.towardsdatascience.com
 Machine Learning Mastery. (June 21, 2020). 7 Time Series Datasets for Machine Learning. https://machinelearningmastery.com/time-series-datasets-for-machine-learning/
This article was first published in Towards Data Science’ Medium publication.