SUM

SUM(*values)[source]

Calculates the sum of one or more numeric values.

This formula computes the total of the specified values. Each input must be an int, float, or a Operand whose data type is numeric (INTEGER, INTEGER_ARRAY, DECIMAL, DECIMAL_ARRAY). If any input is blank or in an error state, the formula evaluates to an error.

Parameters:

*values (Operand | int | float) –

One or more arguments to be summed.

Supported types:

  • INTEGER

  • INTEGER_ARRAY

  • DECIMAL

  • DECIMAL_ARRAY

Return type:

Formula

Returns:

The total sum of the specified values. If all inputs are integers, the result is INTEGER. If any input is DECIMAL or DECIMAL_ARRAY, the result is DECIMAL.

Supported types:

  • INTEGER

  • DECIMAL

Raises:
  • ValueError – if no arguments are provided.

  • ValueError – if any argument is not a numeric type.

Examples

Summing scalars:

SUM(1, 2, 3)
# Returns 6

Summing arrays:

SUM(my_table["amount"], my_table["tax"])
# Returns the sum of the two columns amount and tax