SUM Function: Sum Calculation

SUM Function is used to calculate the sum of numbers.
This function can perform the same thing as the '+' operator. It can also sum up values of fields in a table.
For example, by specifying subtotal fields using "SUM(subtotal)" in the field to display the result, you can calculate the total amount.

SUM (Value1, Value2, Value3, ...)

For Value, specify the code of a "Number" field, a formula that results in a numerical value, or a number.

Calculating the Sum of Values in a Table

This section describes the way to display the sum of subtotal values in the table into the "Total amount" field.

Image of the completed app: Completed app

For details on tables, see the "Adding Tables into Forms" page.

Adding a Table in an App Form

First, you add a table in an app form. If you have already added a table, proceed to "Displaying the Sum of Subtotals in the Total Amount Field".

  1. Click the app setting button Setting button on the upper right of the record view, and select the "Form" tab.

  2. Place a table in the form and add fields you want to include one at a time using drag and drop operation.
    For details, see the "Adding Tables into Forms" page.

Now a table is created. Table

Displaying the Sum of Subtotals in the Total Amount Field (SUM Function)

  1. From the parts list shown in the left side, drag and drop the Calculated field.

  2. Open the screen to set the Calculated field, and enter "Total amount" as the field name.
    Keep the screen open.

  3. Enter the SUM function that calculates the total amount of values in the table.
    In this example, enter "SUM(Subtotal)" to calculate the total amount of subtotals.

  4. To make the total amount easy to read, select "Number with thousands separator (1,000)".

  5. Change the field code to "Total amount", and click Save.

  6. Click Save Form on the upper left side of the screen, and then click Update App on the upper right side of the screen.

Now, the Calculated field to display the total amount is set. Calculated field is set

Check that the sum of subtotal values in the table is displayed into the Total amount field. Sum of subtotal values

TIPS: Empty Fields

Even when there are empty fields, those field values are considered as 0, and the subtotal is calculated. The calculation result is reflected in the total amount as well. Sum of subtotal values

Calculating Date & time, Date, Time, Hours

In the Calculated field, you can calculate Date & time, Date, Time, and Hours in addition to numbers
For example, you can set "End - Start" formula, to automatically calculate the time taken to respond to an inquiry Calculating response time

You can also set a formula "SUM(Response_time)" in the "Response time total" field, to sum up the time taken to respond to customers. Formula to sum up response times Total response times