Smart solutions 4: Integrate NAV with an Azure Machine Learning Model in less than 10 steps

This post is a summary of what was new already in Dynamics NAV 2017: Using “Microsoft Azure Machine Learning Studio” to create (load) and then publish a model which we will call from Dynamics NAV to make inventory or cash forecasts. This is the model which is already available:     Searching the web for “Cortana Intelligence in Microsoft Dynamics NAV” will give you the details already. Here we will summarize them and set the scene for future posts about integrating Machine Learning (ML) models in Azure.

What is Microsoft Azure Machine Learning Studio

If you don’t have access already, now is a good time to go to and sign up for an account. You can choose the free (green) model, which will be based in South Central US and have limits on scalability but it works for experimenting. The studio lets you create experiments and then publish them as a web service. Another option is to save them to Azure and share (or sell) them. The studio has a rich library of sample models, sample data, documentation, algorithms, data manipulation and transformation modules, R and Python runtime and much more, and is central to the meaning of enabling insights and information that until now has been impossible, and democratizing Machine Learning. In this post and in the future posts, we will be exploring how to access this great new world of opportunities from Dynamics NAV.

You already have it in Dynamics NAV – here is how to enable it

Dynamics NAV 2017 already introduced the Time Series functionality to use Azure ML to make cash– and inventory forecasts. Here is how you can enable it for Inventory forecast in less than 10 steps.

The following steps are based on the demonstration data for Dynamics NAV 2018:

  1. Go to your Item List and notice that for any item, the Forecast FactBox says “Not enough historical data”:
  2. Create a new item based on the “Item RETAIL” template. Next, create enough historical data by going to “Item Journals” and then create and post 6 lines for the item of type = Sale and quantity = 2, 4, 6, 8, 10, then 12.
    Make sure that the “Posting Date” field is within the most recent 6 months earlier than the working date. The important things here are that you post sales data to more than 5 historical periods and that the quantities contain a pattern that can be used for predictions:</ br>
  3. After posting, return to the item list and refresh it. Notice that the Forecast FactBox for the item should now say “Sales forecast not available for this item”. Click on “Set Up” on the FaxtBox to open “MS – Sales Forecast Setup Card”:
  4. Click on “Open Cortana Intelligence Gallery” to open the Azure Machine Learning model for Financials, which is a ready-made model that we will use. Here you need to have an account or sign up for one. As mentioned above, the free account is fine for this purpose.
    Click “Open in Studio”, and you will see the model that we will call from Dynamics NAV. Notice a few parts of the interface – framed in green colors below: On the left, you can switch between Experiments and Web Services. Experiments are your work in progress, and when your experiment works, you publish it as a Web Service. Also, notice the Run and “Deploy Web Service” buttons at the bottom:
  5. Click “Run” to verify the model, and once it has run successfully, click “Deploy Web Service”.
  6. After you deploy it as a web service, you get an API Key. Click on “REQUEST/RESPONSE” to get a POST Request URI. Copy these two values into API URI and API Key in NAV. Then click “Show more fields” to reveal “Variance %” and increase this from 35 to 95. This increases the tolerance of how much the historical data can vary from the system to still show a prediction. Then click “Update Forecast”:
  7. Wait a bit, then hit Refresh, until the field “Last Run Completed” is updated. When you close the setup page, you should see that you now have a working forecast for the item:

It might not seem like a big deal but you can now generate forecasts based on data you already have. However, the result here is the fact that you have now activated a cloud based Machine Learning algorithm to apply analysis on your data on demand. All in less there are less than 10 steps.

What’s next

In an earlier post, we looked at Azure Cloud Services to help with Image Recognition: In the coming posts, we will look at connecting to Azure Machine Learning Cloud Services. So until then, have a look around, see what you can do, and feel free to suggest any ideas.