With the formula field you can calculate a result mathematically. You can use mathematical operators, functions and variables.

Formula fields are used in reports like the Cash flow or Key figures which display the result in their own way.

Operators

You can use the following operators:

+ Addition

- Subtraction

/ Division

* Multiplication

You can also use brackets to group formulas.

Examples:

7 + 4 * 2 = 15

(5 + 4) * (3 - 1) = 18

4 / 2 = 2

Variables

You can use the following variables:

$openingAssets
Opening balance of all assets in the selected time period.

$changeAssets
Balance change of all assets in the selected time period.

$balanceAssets (Alias: $assets)
Balance of all assets in the selected time period.

$openingLiabilities
Opening balance of all liabilities in the selected time period.

$changeLiabilities
Balance change of all liabilities in the selected time period.

$balanceLiabilities (Alias: $liabilities)
Balance of all liabilities in the selected time period.

$expense
Balance of all expenses in the selected time period (without profit/loss).

$revenue
Balance of all revenues in the selected time period (without profit/loss).

$netResult (Alias: $result)
Net result (net profit/loss) of the selected time period, without sales tax.

$grossResult
Gross result (profit/loss) of the selection time period, containing sales tax.

$years
Number of years in the selected time period.

$months
Number of months in the selected time period.

$weeks
Number of weeks in the selected time period.

$days
Number of days in the selected time period.

$hours
Number of hours in the selected time period.

Example:

$expense + $netResult - $revenue = 0

Functions

Account functions

opening(x)
Opening balance of the account, category or account range in the selected time period.

change(x)
Balance change of the account, category or account range in the selected time period.

balance(x)
Balance of the account, category or account range in the selected time period.

average(x)
Average balance of the account, category or account range in the selected time period. This function can only be used for balance sheet accounts, not for income statement accounts.

Examples:

balance(1000) = Balance of the account "1000 Cash"

balance(1000,1020) = Balance sum of the accounts "1000 Cash" and "1020 Bank account"

balance(10) = Balance of the category "10 Current assets"

balance(1500:1599) = Balance sum of the accounts 1500 - 1599 (Mobile tangible assets)

For example if you would like to calculate the value of current assets minus accounts receivable, you would use the following formula:
balance(1000:1399) - balance(1100)
or simply
balance(10) - balance(1100)

Mathematical functions

abs(x)
Returns the absolute value of x.

acos(x)
Returns the arccosine of x, in radians.

asin(x)
Returns the arcsine of x, in radians.

atan(x)
Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians.

atan2(y, x)
Returns the arctangent of the quotient of its arguments.

ceil(x)
Returns the value of x rounded up to its nearest integer.

cos(x)
Returns the cosine of x (x is in radians).

exp(x)
Returns the value of Ex.

floor(x)
Returns the value of x rounded down to its nearest integer.

log(x)
Returns the natural logarithm (base E) of x.

max(x, y, z, ..., n)
Returns the number with the highest value.

min(x, y, z, ..., n)
Returns the number with the lowest value.

pow(x, y)
Returns the value of x to the power of y.

random()
Returns a random number between 0 and 1.

round(x)
Returns the value of x rounded to its nearest integer.

sin(x)
Returns the sine of x (x is in radians).

sqrt(x)
Returns the square root of x.

tan(x)
Returns the tangent of an angle.

Examples:

max(5, 7, 3) = 7

sqrt(4) = 2

ceil(5.4) = 6

round(5.4) = 5

floor(5.6) = 5

Assuming the account "1000 Cash" has changed by 500.00 and the account "1020 Bank" has changed by 800.00. Then the following formulas would return:

max(change(1000), change(1020)) = 800.00

min(change(1000), change(1020)) = 500.00

A more complex example:

(balance(100) + balance(1100:1109)) / balance(20) * 100
= (Liquid funds + Accounts receivable) / Current liabilities × 100
= Acid Test Ratio