Sum / List Layer
Calculate the sum of elements in variable-length numeric lists. Similar to numpy.sum() or R's sum(). Returns the total of all non-null elements in each list. Empty lists return 0.
Example transformation:
lists | sum |
---|---|
[1, 2, 3, 4] | 10 |
[10, 20] | 30 |
[1, null, 3, null] | 4 |
[1.5, 2.5] | 4.0 |
[] | 0 |
[null, null] | 0 |
Common applications:
- Calculating total sales by transaction
- Summing page views per session
- Computing total scores in games
- Aggregating sensor readings
- Adding up inventory quantities
- Calculating total expenses
- Summing interaction counts
Note: Lists can have any length. Null values are ignored in summation. Empty lists and lists with only nulls return 0. Only works with numeric lists. Particularly useful for calculating totals from variable-length sequences.
Table
0
0
Table
Select
columnThe variable-length numeric list column to sum. Examples:
- Daily sales: [100.50, 200.75, 150.25]
- Click counts: [5, 3, 2, 4]
- Measurements: [1.1, 1.2]
- Quantities: [10] Lists can have different lengths. Only numeric types supported.
AsColumn
nameName for the new column. If not provided, the system generates a unique name. If AsColumn
matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.