To sum values in a document, open a collection and tap on button → Select Fields.
You should create two decimal number fields such as Amount 1 and Amount 2.


Tap on Edit.


Add a Formula field with the button.


Select Decimal number.


Tap on Done.


Open the newly created field.


Assign a name such as Sum and tap on Edit formula.


The formula is empty. Tap on the button to add an expression.


Scroll down and select the Sum function.


Tap on the button again.


Select Amount 1 (or another field) from the list.


Tap on button and repeat the previous step selecting Amount 2 (or another field).


The formula is completed, tap on Save to confirm.
Subctract values
To subctract values (difference between values) you can use use the Minus function. The Minus function prepends a minus in front of a number.

The example shows how to use the Minus function.