# Calculate field values

This feature is used to apply values from specific fields to calculate the value of other fields.

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FFtBdEoapdmd49DIkuvmb%2Fimage.png?alt=media\&token=79a131f4-c34b-41de-8a88-0ee081b6023a)

To calculate a field value,

1\.    Under **Calculate field values**, to enter a condition for calculating field values, click **Set condition**.

Let's say we there are 3 fields in a form: **Number of days**, **Expense per day** and **Total expense**. The **Total expense** can be calculated by using the formula: **Total expense = Number of days \* Expense per day**. Let's add in a condition that the **Total expenses** field will only be auto-calculated if the **Number of days** is greater than 1.

2\.    To configure a condition for the calculation of a value for the field, under **Calculate field values**, click **Set condition**.

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FOgpaWue6Mf0APgVtus1e%2Fimage.png?alt=media\&token=38b2082d-1c68-4030-9280-49f6ee4fd94f)

The **Set condition** screen is displayed.

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2F9OE42aLVZvS7EbEGRcRE%2Fimage.png?alt=media\&token=19becafe-f152-4844-89cb-746c678cfd15)

2\.    To add a condition, click **Add rule**.

The option to add a condition is displayed.

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FUc6CvRxAgQ7T4GKcz0jy%2Fimage.png?alt=media\&token=6c904f40-2625-47b4-bac1-3364c84cd701)

3\.    To enter the condition, enter the required field name, operator and the field value and then click **Apply**.&#x20;

The condition is added in the **Calculate field values** tab.

3\.    In the text area, enter the required formula using the keypad on the right.

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FDY2WKvgxDC9dGZe3IYLr%2Fimage.png?alt=media\&token=4ee35be5-93b9-4201-9030-31f526139d46)

{% hint style="info" %}
To use the standard math functions namely algebraic, logarithmic  and trigonometric functions, click Add func.
{% endhint %}

> Add func. has 2 categories: Custom functions and Math functions.&#x20;
>
> Math functions are algebraic, logarithmic  and trigonometric functions.&#x20;
>
> Custom functions includes some commonly used custom made javascript expressions like getDate(), getMonth(), Sum(), average() and more.&#x20;

&#x20;The **Paste formula** is auto-filled based on the formula entered in the text area.

4\.    In **Select field for final output**, select the field in which the calculated value is to be displayed.&#x20;

5\.    To save the settings, at the bottom right of the screen, click **Save**.

Based on the formula and settings configured above, the **Total expense** field will be auto-filled whenever the **Number of days** field has a value greater than 1.

![](https://4216568905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mc6E3BSGr4i8kVdH38k%2Fuploads%2FKdeY9Vt5PgQkER1WYkZQ%2Fimage.png?alt=media\&token=5a96f21e-76d7-4677-889c-69bf6bf91522)
