sum
Description
Returns the total of all numerical values passed into the function.
- Can be used in aggregation to compute totals across grouped rows.
- When used with multiple arguments, returns the sum of all provided values.
Syntax
Arguments
Name | Type | Required | Description |
---|---|---|---|
value | number | true | The first numerical value to add |
...values | number | true | One or more additional numerical values to add |
Example
Description
Use case: Calculate total money spent per user
Suppose you want to compute the total amount of money spent by each user.
Example logs
{ "user": "Chris", "product": "Sunglasses", "price": 10 },
{ "user": "Chris", "product": "Car", "price": 1000 },
{ "user": "Dave", "product": "Desk", "price": 250 }
Example query
Example output
user | sum_price |
---|---|
Chris | 1010 |
Dave | 250 |
Theme
Light