# Calculate field values

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

![](/files/q3NXTjERqG2kBhBgJD1Q)

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**.

![](/files/306TmsKFk32RyrMybBub)

The **Set condition** screen is displayed.

![](/files/vSjmqdDleP9cuB1NVO5K)

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

The option to add a condition is displayed.

![](/files/cKZRpiUhhgVwsZG7c7bN)

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.

![](/files/GCjJgTkKBS667zoKg4N5)

{% 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.

![](/files/SuKsco0ShGxgnZMN6Cmd)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.senpiper.com/form-builder/creating-forms/additional-form-settings/conditions/calculate-field-values.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
