Comment on page
This example demonstrates how to use the Goal Seek Function to calculate the desired units that need to be sold to reach a certain amount of revenue.
The sample data file includes NumUnits, UnitPrice, DiscountPercent, and TargetRevenue columns. The revenue formula is
Revenue = NumUnits * UnitPrice * (100.0 - DiscountPercent) / 100.0
Drag the Goal Seek Agent onto the canvas, link the input endpoint to the revenue data, and the output to the printer. Rename the Agent and save the Data Stream.
Select the Agent and click Configure. Keep the default Collection.
Set the goal being sought: the formula, expected value, and the goal seek variable.
In this case, set the formula to RevenueFormula, set the expected value to TargetRevenue, and the goal seek variable to NumUnits.
Optimize how it is sought: the starting stab value, initial tine spacing, and the maximum number of attempts.
In this case, set the starting stab value to 1, and keep the default initial tine spacing and maximum attempts of 1 and 1000 respectively.
The algorithm's first attempt will substitute the values 1, 2 (1+1), and 0 (1-1) into the formula. It will adjust the guesses until it reaches the expected value - or the maximum number of attempts is reached, which in this example is 1000 attempts.
Apply the changes, save the Data Stream and publish it.
Let's look at the Live Data View. Three columns are appended to the incoming events:
- Seek Result shows the number of units needed to be sold to reach the Target Revenue with the given Unit Price and Discount Percent.
- Within Acceptance Threshold shows whether the answer was found within the number of attempts possible.
- Stab Attempts provides information on the number of guesses to find the answer.