Scenario Overview

In this scenario we need to compare the difference between the estimated revenue of an Opportunity vs the actual revenue generated from an opportunity. A potential error here can arise if one or more of the values are zero. We use the function ContainsDataAndNotZero to counteract this.

N52 Formula Manager Solution

The Formula Manager solution works like this,

  • A formula of type ClientSide Perform Action is created so that when the Estimate Revenue or  Actual Revenue fields are filled, the formula executes.
  • The formula checks to see if the two fields contain Data
  • If they do, the formula calculates and fills in the field % of Estimate Value.

N52 Formula Manager Steps

Note: For these steps, it is presumed the field of Estimate Value has been created and that the field ActualRevenue has been added to the Opportunity form.  


  • Create a new formula of type 'ClientSide - Perform Action'
  • Set the Event to 'Create and Update'
  • Set the Source Entity to 'Opportunity'
  • For Source Property, Scroll to *** Opportunity Events *** and Ctrl click EstRevenue and Actual Revenue
  • Go to the Formula editor canvas
  • Click on the Snippets menu
  • Click on Smartflow
  • Delete everything besides Smartflow and its brackets
  • Select inside Smartflow brackets
  • Press enter twice
  • Click on Snippets 
  • Click on If
  • Delete the 'expression' placeholder text
  • Go to the Functions Tab
  • Search for "contains"
  • Shift + click the function ContainsDataAndNotZero
  • From the function wizard, click on the search icon
  • Select Actual Revenue and EstRevenue 
  • Click the Generate button
  • Highlight the true parameter and press delete and then enter
  • Go to the Function tab and search for "SetVar"
  • Click on SetVar
  • Highlight 'variablename' and replace it with ' PercentEst  '
  • Delete 'value' including the parameters
  • Go to the Source tab
  • Search for "revenue"
  • Expand the Source node
  • Click on Est. Revenue
  • Type '/' just outside of the right hand square bracket
  • From the Source node, click on Actual Revenue
  • Highlight the 'false' parameter
  • Delete it and press enter
  • Go to the Function tab and search for "SetVar"
  • Click on SetVar
  • Highlight 'variablename' and replace it with 'PercentEst'
  • Delete 'value' including the parameters
  • Replace it with 0
  • Select the empty space in the line under this function
  • Press enter twice
  • Go to the Function tab
  • Search for "updaterecord"
  • Click on UpdateRecord
  • Replace 'entityname' with 'opportunity'
  • Delete 'primarykeyid' including the parameters
  • Leave the cursor there and open up the Source tab
  • Search for "opp" and click on Opportunity
  • Delete 'attributename' and leave the cursor there
  • Open Source tab and search for "%"
  • Ctrl + click on % of Estimate Value to insert the attribute schema reference name * 
  • Delete 'attributevalue' and replace it with GetVar('PercentEst')
  • Click Save
  • The formula is now ready for testing. 

*Note this field was custom created for this example, you will need to create it or use another field. 

    Wizard - ContainsDataAndNotZero

    Please see below the wizard you can use to create the ContainsDataAndNotZero() function call used in this formula. 

    Did you know?

    North52 Decision Suite helps streamline complex business processes

    North52 Decision Suite is a cloud-based or on-premise decision management/decision engine platform for the Dynamics 365 and Power Platform that uses data, analytics and business rules to automate decisions.

    Companies use North52 to streamline their processes, improve the quality of the decisions inside their Dynamics 365 systems, and shorten the time it takes to adjust to business and competitive changes.

    Learn more about the North52 Decision Suite