How Can I Specify a Scoring Formula (Advanced)?

How Can I Specify a Scoring Formula (Advanced)?


Sometimes, you want each transaction's value to be calculated using dynamic rules.



Do You Need A Scoring Formula?
In most cases, calculating a transaction's value based on its revenue or profit is sufficient.

When using revenue or profit as an attainment metric, Sales Cookie will try to calculate them automatically for you.



Also, you can certainly use reward formulas to calculate payouts without requiring a per-transaction score.



However, there are situations where you may need to "value" transactions in a more flexible way. For example, you could decide that:
  • You want to count transactions, so you can't use revenue or profit
  • A transaction's value should be zero if the revenue is under a certain value
  • A transaction's value should be calculated as the sum of two fields
  • A transaction's value depends on the type of product sold
  • A transaction's value should be based on previous commission amounts
  • Etc.

For those cases, you can use a scoring formula. Once calculated, your score can be re-used by other formulas. You can also use scores as an attainment metric.

Creating a Scoring Formula
First, review this article about formulas to understand how they work, and which constructs are available.

Second, choose whether you just want to a/ calculate a score per-transaction (which you can then refer to in other formulas), or b/ want to use scoring as an attainment metric.

If you want to use a score-based attainment metric, choose this:



Otherwise, you can still calculate a per-transaction score "on the side", and refer to this score in other formulas (ex: reward formulas). 

Next, create a scoring formula:
  • Edit your plan
  • Click on the "Scoring" tab (if needed)
  • Select "Calculate A Score Using A Formula"
  • Enter a scoring formula (examples below)

Your scoring formula could be very simple - for example, to count each credited transaction as 1 point, you would use this:



Your formula's output should be a numeric value.

Scoring Formula Examples
Assume that you uploaded transactions with the following fields:
  • Quantity (a number field)
  • City (a text field)

Here are some examples of formulas you could use to configure scoring.

Calculate A Score Based On A Count
1

Calculate A Score Based On Quantity
var $quantity = [Transaction].[Quantity (Imported)]
--------------------------------------------------------------------
2.5 * $quantity + 4

Calculate A Score Based On Revenue And Profit
[Transaction].[calculated_revenue] - 3 * [Transaction].[calculated_profit]

Calculate A Score Based On City And Quantity 
var $quantity = [Transaction].[Quantity (Imported)]
--------------------------------------------------------------------
var $city = [Transaction].[City (Imported)]
--------------------------------------------------------------------
IFEX($quantity >= 100 AND $city = 'Osaka', 2 * [Transaction].[Quantity (Imported)])
--------------------------------------------------------------------
IFEX($quantity >= 400 AND $city = 'Madrid', 3 * [Transaction].[Quantity (Imported)])
--------------------------------------------------------------------
0

    • Related Articles

    • How Can I Specify A Dynamic Crediting Formula (Advanced)

      Sometimes, you want to credit users or teams based on dynamic crediting rules. Do You Need A Crediting Formula? In most cases, it's sufficient to rely on aliases and system mapped transaction fields to credit users or teams. The following crediting ...
    • How Can I Specify a Custom Formula (Advanced)?

      Sometimes, you want to customize attainment and require a formula to do so. Do You Need A Custom Formula? In most cases, calculating a transaction's value based on its revenue or profit is sufficient. When using revenue or profit as an attainment ...
    • How Can I Specify A Dynamic Transaction Filtering Formula (Advanced)

      Sometimes, you want to filter transactions based on dynamic rules. Do You Need A Filtering Formula? In most cases, it's sufficient to rely on saved queries to filter transactions. For example, you could define a transaction filter such as this: And ...
    • How Can I Specify a Dynamic Quota Formula (Advanced)?

      Sometimes, you need quotas to be calculated dynamically using a quota formula. Do You Need A Quota Formula? In most cases, it's sufficient to use available quota options (such as "As Percentages of a Per-Target Dynamic Quota" or "As Percentages of a ...
    • How Can I Calculate a Complicated Global Reward (Advanced)?

      Sometimes, you want to calculate a total (gross, lump sum) commission amount based on complex rules. Do You Need A Global Reward Formula? In most cases, it's sufficient to rely to use pre-canned rewards such as "% of Revenue", "% of Profit", or "Cash ...