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