Before getting into the Builder itself, I find it very useful to look at the established Sales Insights App for Dynamics – as this works in many similar ways and gives a view of what a potential end-point looks like.

But the real weight is in the Power Apps Maker and getting into the AI Builder proper.

clip_image001

Here we can create a new Model or examine the Test Model created in the Sandbox.

As this Model has had time to analyse the data, we can click in and get an idea of how its weighted the data it is looking at:

clip_image002

But if we click Edit Model, we can see how I’ve set this up.

What do you want to Predict?

First off, we define our Win State and Lost State that we want the Model to analyse for:

clip_image003

This allows us to pick the Entity, then a Field, and define what the Win/Loss States are for this Field.

Click NEXT and then we are onto the Data we want to analyse to see how the Data affects this Win/Lose State.

Review the Data going into your Model

This is essentially a Field Picker for the Entity we are analysing – but with the option to pull other Parent or Child fields into the mix as well.

clip_image004

My take here is that this would often go hand-in-hand with Dynamics Rollup Fields for analysing Child Entities – as MIN, MAX, SUM and COUNT fields up to the Opportunity will always be helpful in providing key metrics that are good for analysis.

This will work similar to traditional reporting where Option Sets, Lookups, Numbers and Currencies as ‘hard’ fields will be best for the Model to analyse.

Text is still fine, but often best when analysing segmental styles of text, such as Postcodes or City Names.

Filters

We can then apply Filters to our Model to control which elements of Data it looks at.

We can skip this and simply analyse all Opportunities everywhere – but when we run this we may want our Model to look at a particular Business Unit or Opportunity Type.

clip_image005

Train it..

With the Entity, Win/Loss States, Data and Filters set – the Model is ready to start analysing the data to compare how each Field or Metric is influencing the likelihood of leaning a record to the identified Win State or Loss State.

clip_image006

What next?

Now trained, we see our model presenting which areas of the data we have provided are the most influential in predicting whether a record will hit its ‘win’ state or ‘loss’ state – probably here expressing this a a positive or negative outcome is better terminology as this is not just for Opportunities with a traditional win or lost model.

We can now use the Model in a number of ways.

The most immediate is using Power Automate to query the model and populate fields about a record as a result, this uses the ‘Predict in Real Time’ action in Power Automate.

We call this action with a number of inputs from the record we want to predict and this then compares these values to the model we have trained:

image

This returns a set of values that we can insert into our record in Dynamics to describe what our Model predicts will happen .i.e. the rate of probability that the record will have a positive or negative outcome.

image

This breaks into three sets of information:

Explanation – a JSON document describing the Fields in the Input that have produced the predicted outcome, and how each has been weighted in the Model for this set of Inputs:

[{“entityName”: “opportunity”, “attributeName”: “new_grossprofitpercentage”, “weight”: 0.3210554504840574}, {“entityName”: “crmcs_projects”, “attributeName”: “crmcs_name”, “weight”: 0.28638559308774103}, {“entityName”: “crmcs_projects”, “attributeName”: “crmcs_projecttype”, “weight”: 0.13992829903618048}]

Likelihood – the overall % chance that the model is predicting the right outcome

0.9806 = 98%

Prediction – the predicted outcome for our success/failure field; for an option set, this will be the numerical value of the option set value predicted by our model.

2

Here, the way this works is that our Model is effectively a Datasource that we can query at any time.

We query the Model with our combination of inputs and this consults the model to return these 3 outputs – effectively working as a typical Webservice that we can consult for information on our business and its predicted outcomes.

This is why the process plugs neatly into Power Automate as most actions in Automate are effectively calling out to REST Endpoints to retrieve information or invoke certain actions.

We can put this approach to use in a number of different ways.

  • Continue using Power Automate to read the information back and insert into Dynamics / Power Apps as a way of predicting in real time.
  • Call our Model via a Custom UI to present a graphical prediction in real-time.
    • This could be done within a record in Dynamics as a mini-dashboard
    • Or a wider Dashboard that presents the overall Model back to us
  • Build a number of Models and then use a Parent Model or set of Logic to crunch a number of Models into different predictions.

In these ways, we can use the Predictive Models to provide Insights back to our Dynamics Users and tailor what’s likely to happen based on our past data.


Further Reading

The following three articles show how to use the prediction model in Power Automate:

https://docs.microsoft.com/en-us/ai-builder/prediction-pwr-automate

https://docs.microsoft.com/en-us/ai-builder/predict-action-pwr-automate

Calling a Power Platform AI Builder Model via oData (crmcs.co.uk) 

Using your Model to predict a Range of Outcomes

https://powerapps.microsoft.com/en-us/blog/ai-builder-now-supports-predicting-multiple-outcomes-preview/

Author

Write A Comment