sum

statistics

Calculates the sum of all values

Syntax

sum(array|dataframe)

Parameters

array|dataframe (array or dataframe)

The data to calculate the sum of

Returns

number

The sum of all values

Examples

Input:
[1, 2, 3, 4] | sum
Output:
10
Total amount from transactions
Input:
map(.amount) | sum
Output:
1250.75
Sum of sales column
Input:
.sales | sum
Output:
54320.00

The sum() function calculates the total sum of all numeric values in an array or DataFrame column.

Usage

Use sum() for aggregating totals, calculating cumulative values, and summing financial or numeric data.

Related Functions