Let’s talk about demand forecasting and its architecture in D365FO first to set the foundation. Demand forecasting is implemented often to reduce costs, decrease lead times, order items with longer lead time items ahead of time. It allows us to look at holistic demand over a larger amount if time. It could feed into global capacity planning and strategic planning overall. Itt increases revenue and it prevents supply chain shortages/stock out as much as possible.

Demand forecasting in D365FO is orchestrated between D365FO where the historical data originates from, where you are triggering the ML experiment from and where you run the baseline generation from. Azure Machine learning where the ML experiment is ran/executed and where the demand forecast is generated and Azure Data Lake/Azure Storage where the demand forecast results are stored after the run is completed. The baseline results are published back into D365FO where you can review the results, do manually adjustments, and authorize the demand forecast.

**Introduction Demand Forecasting **

The main strategy in D365FO Demand forecasting when we use Azure ML is time series forecasting. Time series forecasting refers to models that uses previous demand values to predict future demand.

We can break the general components of a timeseries forecast model into 3 buckets.

1. First we have the trend. The trend is the general direction in which our demand is moving. E.g. increasing or decreasing.

2. Next we have seasonality. Seasonality represents short term patterns in our demand. E.g. We may have a trend in demand where we see a spike in the end of quarter due to a push in close sales or we see an annual pattern where demand spikes during our summer months. Seasonality does not have to relate to specific seasons of the year but it can.

3. Error – error refers to the unexplained or random variation in our time series.

In real life there is no way to create a model that explains our trend and seasonality with 100% accuracy so there is always a degree of error. Adding the 3 components together we can predict our demand – the different statistical forecasting algorithms used by dynamics and other forecasting tools will calculate and combine these general components in different ways, allowing us to compare different forecasting models and select the one that best seems to predict our demand. At the core we are trying to build an equation with those components to predict our demand for different points in the future as accurate as possible. When we generate a forecast with time series models, we use our past demand history data points to build out the forecast equation and estimate its accuracy. We start with taking a subset (blue circles in the graph) of demand history data. And we use the parameters we have set in D365FO and feed the information into Azure ML. In Azure, the statistical modelling tools essentially create an equation to predict future demand. The output of the equation build in Azure is our expected demand value at time T. When we generate a forecast for the next year, for example we will use this equation to get the values of demand for T in jan, T in feb and so on. D365FO does not return to us the equation itself that is derived by the forecast tool, but I wanted to make sure that you understand what happens after you click that generate forecast button in D365FO. We only use a subset of the demand history to generate the forecast equation. The remaining data points we keep in reserve will then be used to estimate the accuracy of the equation built.

## Comentarios