Configuring Formulas using the Formula Attribute
The Handling Blank Values in Formula Attributes feature is under Public Preview. Please contact OneTrust Support to request early access.
You can configure a mathematical formula using the formula attribute for risks, controls, and inventories to perform risk calculations. The formula attribute is an attribute value on a risk, control, or inventory. Formulas are supported in both Formula and Score Formula response types.
To create a formula, you must have active numerical text, numerical - single select, and/or score attributes added to your Attribute Manager. You also have the ability to use existing formula attributes in your calculation. For more information on adding attributes, see Adding, Editing, and Deactivating Attributes.
Rounding Rules for Formula Attributes
Rounding is applied immediately after each formula evaluation. This ensures consistent results, regardless of whether formulas are evaluated individually or in a batch. The current rounding rules listed below will apply to all formula attribute calculations:
- Input-Based Precision Rule
-
If any input attribute (not hard-coded values) has a decimal, the maximum number of decimal places among those inputs is used as the rounding precision.
For example, the inputs of 5.12, 3.14, 2.78 will have the max precision of 3 decimal places.
- No Decimal in Inputs
-
If none of the input attributes have decimals, the formula decides the precision. The max precision cannot exceed 3 decimal places.
- No Fixed Default Precision
-
There is no universal default like "always round to 3 decimals". The system uses the precision of the input values to determine rounding.
To configure a formula
Add Attribute Screen Reference
- Field
- Description
- Name
-
Enter a name of the attribute.
- Description
-
Enter a brief description of the attribute.
- Response Type
-
Select Formula to allow users to build a formula to calculate risks.
- Link Category
-
Enable this setting to select the risk categories that you would like to link to the attribute.
Note:This setting is only available for risk attributes.
- Formula
-
Build the formula using functions and existing risk attributes. For more information, see Use Case.
Tip:You can use multiple attributes in the mathematical formula. To add multiple attributes to your formula, separate the attribute values with commas and place the attribute values inside the parenthesis of the formula.
The standard characters needed for mathematical functions include:
-
Addition: +
-
Division: /
-
Modulo: %
-
Multiplication: *
-
Subtraction: -
/, %, and * have the same precedence and are evaluated from left to right.
+ and - have lower precedence than the above operators.
-
- Function
-
Select from the default functions provided to build the formula. Some of the most common functions used are:
Function
Description
Syntax & Formula
SUM
Adds up a range of values.
This is used to calculate a single summarized value from a set of related records and return it to a parent object.
Syntax: SUM (value 1, value 2, ...)
Formula Example: = SUM (Assets: Aggregate Residual Score, Assets: Aggregate Inherent Score)
This formula will sum all aggregate residual and inherent scores for an asset.
AVG
Calculates the average of a set of values. This is used to calculate a single summarized value from a set of related records and return it to a parent object.
Syntax: AVG (value 1, value 2, ...)
Formula Example: Residual Risk Score = Inherent Risk Score - AVG (Control Effectiveness)
This formula will return the average of all Control Effectiveness values linked to that risk, returning a single value that can be used in the formula. This ensure that the Residual Risk Score dynamically reflects the overall effectiveness of all mapped controls.
MAX
Returns the largest number in a set of values. This is used to calculate a single summarized value from a set of related records and return it to a parent object.
Syntax: MAX (value 1, value 2, ...)
Formula: = MAX (Control Effectiveness)
This formula will return the largest value from the control effectiveness value.
MIN
Returns the smallest number in a set of values. This is used to calculate a single summarized value from a set of related records and return it to a parent object.
Syntax: MIN (value 1, value 2, ...)
Formula: = MIN (Inherent Risk Score, Residual Risk Score, Target Risk Score)
This formula will return the smallest value from the risk scores.
LOG
The logarithm of a number is the exponent by which another fixed value, the base, must be raised to produce that number. This is used to calculate a single summarized value from a set of related records and return it to a parent object.Note:Singular Values: Can be a numeric attribute or combined with an aggregate function.
Syntax: LOG (number, [base])
Formula: = LOG (Assets: Aggregate Residual Score) or = LOG (SUM (Risk: Residual Score))
LN
The natural logarithm of x is the power to which e would have to be raised to equal x. This is used to calculate a single summarized value from a set of related records and return it to a parent object.Note:Singular Values: Can be a numeric attribute or combined with an aggregate function.
Syntax: LN(number)
SQRT
A mathematical function where the input (x) is placed inside a square root symbol (√). The output is the number that, when multiplied by itself, equals the input. In its simplest form, it's represented as f(x) = √x.
This is used to calculate a single summarized value from a set of related records and return it to a parent object.Note:Singular Values: Can be a numeric attribute or combined with an aggregate function.
Syntax: SQRT(number)
EXP
The unique real function which maps zero to one and has a derivative equal to its value. This is used to calculate a single summarized value from a set of related records and return it to a parent object.
Syntax: EXP(number)
IF
Returns a value based on whether a condition is true or false.
Nested Syntax:
=IF(condition1, result1,IF(condition2, result2,IF(condition3, result3,IF(condition4, result4,IF(condition5, result5,IF(condition6, result6,IF(condition7, result7,IF(condition8, result8,IF(condition9, result9,IF(condition10, result10,default_result))))))))))
Single Syntax:
=IF (condition, value_if_true, value_if_false)
Formula: = IF (AVG (Control Effectiveness) > 3, 4, IF(AVG(Control Effectivess) >, 8, 14))
AND
Returns true if all configurations evaluate to true and returns false if one or more configurations evaluate to false. It combines multiple conditions that all need to be true.
Syntax: AND(logical1)
Formula: IF (Risk: Residual Score > Risk: Inherent Score AND (Risk: Residual Score > Risk: Target Score), {Then EXPRESSION}, {Else EXPRESSION})
OR
Returns true if any of its configurations evaluate to true and returns false if all of its configurations evaluate to false. It combines multiple conditions where at least one needs to be true.
Syntax: OR(logical1, [logical2], …)
Formula: = SUM (Children Risk < 5 OR (Residual Risk Rollup Score > 20))
This formula will return the sum of children risk over 5 or residual risk rollup scores lower than 20.
COUNT
An aggregator function used primarily to count the number of related records linked to a parent object. Returns the number of entries that are a number value.
Syntax: COUNT(value1, [value2], …)
Formula #1: = COUNT(Issue Status = 1)
This formula will return count of open issues. This is useful for reporting, dashboards, and risk scoring where you only want to count items in a certain state (e.g., open, overdue, or unresolved).
Formula #2: = IF(COUNT(Issue Status = 1) > 2, 4, 1)
This formula will return 4 if the total open issues are > 2 or else it will return 1.
IN
This can be used in a formula to say "Contains Any".Note:This function is only available for multi select attributes.
Syntax: IN (value1, value2, ...)
Formula: Category IN (Confidentiality, Integrity)
This formula states that the category must be Confidentiality OR Integrity.
NOT IN
This can be used in a formula to say "Does Not Contain".Note:This function is only available for multi select attributes.
Syntax: NOT IN (value1, value2, ...)
Formula: = Category NOT IN (Confidentiality, Availability)
This formula states that the category is not in confidentiality or availability.
You can also use the logical operators below when building the formula:
-
= (Equals)
-
< > (Not Equals To)
-
> (Greater Than)
-
< (Less Than)
-
>= (Greater Than or Equal to)
-
<= (Less Than or Equal to)
-
- Risk Attributes
-
Select from custom and system risk attributes in the list provided to build the formula.
You can also include single select and multi select attribute options when creating formulas to help increase the accuracy of risk score calculations by having a comprehensive set of data. The attribute options shown will be based on the attribute selected in the formula.
Note:Single select and multi select attribute options can only be used on the right side of the formula expression.
You can use the Search field to easily filter and locate attributes and attribute options. To view attribute options, click the attribute name. To navigate back to the full list of attributes, click on the down arrow next to the attribute name.
- Rescore Existing Risks
-
Enable this setting to rescore existing risks with the new formula. Disable this setting to only calculate future risks.
To enable blank values in formulas
To edit an existing formula
Use Case
This section includes common formula building use cases that may be helpful when configuring formula attributes.
Use Case #1: Using the IF Function to Build Formulas
You can configure formula type attributes for risks, controls, and inventories using the IF function. This allows you to create conditional formulas to calculate risk scores based on defined criteria.
This formula is created on the Inherent Risk Score attribute. In this case, if the Impact = 1 (Low) and likelihood = 1, set the Inherent Risk to *1, IF the Impact = 2 (Medium), set the Inherent Risk to *2, ELSE i.e. if none of these conditions are met set the Inherent Risk to *2.5.
The IF function only supports numerical values. It does not support alpha numerical items.
Additional IF Function Examples:
Use Case #2: Using the IF Function to Build Formulas
Use Case #3: Formula on Risks
-
IF ( Risk|Residual Risk Score > 10, Risk|Residual Risk Score, 0): This formula on risk will set the value equal to Residual Risk Score if its greater than 10 otherwise it will set the value to 0.
-
Formula on Risk IF (Risk | Residual Risk Score > Risk | Inherent Risk Score, 1, 0) : This formula on risk will set the value of 1 if the residual risk score has increase more than inherent risk score, otherwise it will be zero.
Use Case #4: Formula on Assets
-
Formula on Asset: IF ( AVG (Risk|Residual Risk Score) > 10, AVG (Risk|Residual Risk Score, 0): This formula on asset, will check if the avg of all risks associated to an asset is greater than 10, then set the value to that avg otherwise set to zero.
-
Formula on Asset: IF (AVG (Risk: Residual Risk Score) > 10, 100, IF (AVG (Risk|Residual Risk Score) > 5, 10, 0)): This formula on asset will set the value of 100 if the avg of residual risk score is greater than 10, else if the average of the residual risk score is greater than 5, it will set the value to 10, else value will be set as zero.
Use Case #5: Single Select & Multi Select Attribute Option Support
Risk managers and system admins can seed conditional formulas using attribute options. Simplifying the process of creating formulas and allowing for the setting of attribute values based on specific conditions can reduce the time spent on formula creation, and increase the accuracy of risk score calculations. Attribute options can be configured in the formula when creating a new formula attribute or updating an existing attribute.
In this formula, the risk weightage is populated based on risk category. In this case, the risk weightage is a custom attribute. Category = Privacy, Risk Weightage = 150% Category = Security, Risk Weightage = 200 or else Risk Weightage = 100
Best Practices & Expert Advice
This section includes common formula building insights and best practices that may be helpful when configuring formula attributes.
-
Expressions can be an IF expression or a value expression. Conditional Expressions use logical comparators to get a true/false output, which determines the then/else expression. The left and right sides of the expression should be singular values. For example:
-
IF (CONDITIONAL EXPRESSION, THEN EXPRESSION)
-
IF (CONDITIONAL EXPRESSION, THEN EXPRESSION, ELSE EXPRESSION)
-
-
Things to know about the SUM, AVG, MAX, and MIN functions:
- Singular Values
-
SUM (Assets: Aggregate Residual Score, Assets: Aggregate Inherent Score)
- Related Object Attribute
-
SUM (Risk: Residual Score) (aggregates all risks associated with a particular asset)