Dynamics 365 Demand Forecasting has had standard functionality for awhile. If you’re unfamiliar with it, Microsoft has an overview of its functionality on their Dynamics 365 site. However, the following diagram also illustrates it quite nicely:
Azure Machine Learning is essentially a cloud-based predictive analytical solution. It replaces the SQL Server Analysis Services time series algorithm that AX 2012 uses. For D365 Demand Forecasting, we will use it to predict demand for future time periods based on historical demand. For this example, we’re using the standard demo data. Other than the parameters noted below, no other setup was required.
Dynamics 365 Setup
Our first task is to set up the Demand Forecasting parameters. Set the Forecast generation strategy on “Azure Machine Learning.
Master Planning Setup Demand Forecasting Demand Forecasting parameters
Once set, the following warning will pop up.
Click on Message Details to reveal the remaining setup steps.
Deploying Azure Machine Learning Studio
Now it’s time to set up the experiment in Azure Machine Learning Studio. First, Visit the Demand Forecasting experiment in the Cortana Intelligence Gallery. The Cortana Intelligence Gallery is like an app store for Machine Learning.
Click the “Open in Studio” button to continue.
Next, sign up for an account. The free account will work fine for this example.
Once your account is active, you can deploy the experiment directly from the gallery and select an Azure region for deployment. Please note that if you are deploying D365 on-premises you will also need an Azure storage account.
Once deployed, we can see our Demand Forecasting experiment. The Studio shows two types of inputs—manual data and data received from a web service. In this scenario, the web service is D365. Below that, an R script generates our forecast, and then the calling web service splits and returns our data.
Inputs
Our experiment has three different inputs.
- Web service input – input received from Dynamics 365
- Sample Data – data used when we run the experiment as a standalone
- Parameters – sample parameters used in conjunction with the sample data from above to run the experiment
Generate Forecast
Written in R, a statistical computing and programming language, this is where the brains of the operation reside. R is in part named after the S statistical programming language on which it is based, and its creators, Ross Ihaka and Robert Gentleman from the University of Auckland.
In a gross over simplification, the script restructures and validates the data before generating the forecast based of the model we have chosen to use.
Split Data
The Split data step is a data transformation. We are splitting out dataset output from the R script into two groups, based on the value of the Type column. This gives us two datasets – one good and one with all errors.
Select and Return Datasets
Lastly, we select specific columns we want to return from the datasets and return these to the calling web service.
Deploy the Web Service
We next need to run the script. This validates it so we can deploy the web service we’ll need next.
Once deployed, you’ll be able to grab the API key.
Click on the “API help page” for the REQUEST/RESPONSE to get the web service URL.
For the webservice URL, include everything up to the /execute?api… section, similar to the following example:
https://ussouthcentral.services.azureml.net/workspaces/12add345678901bb2ebb345eb67f890/services/123de45bc6c789012b34567ff89e
Parameter Update
Finally, now we have what we need to update the Demand Forecasting parameters with our values obtained above.
Execution
Now that we’ve finished the setup, we can run demand forecasting from Master planning Forecasting Demand forecasting Generate statistical baseline forecast. In the parameters below, I selected to generate my forecast for the next three months.
And about 10 minutes later…
Now that it’s executed successfully, we can view the forecast from Master planning Forecasting Demand forecasting Adjusted demand forecast.
Have any questions? Don’t hesitate to contact us about setting this up for your Dynamics 365 scenario or with any other questions about the Dynamics family.