# SUM() Function

### Description

Returns the total sum of a numeric column

### Syntax

Aggregate Use:

```sql
SELECT SUM(column_name) AS total
FROM table_name
[WHERE condition];
```

Window Function Use:

```sql
SELECT
  column_name,
  SUM(column_name) OVER (
    [PARTITION BY partition_column]
    [ORDER BY order_column]
    [ROWS BETWEEN ...]
  ) AS running_total
FROM table_name;

```

### Parameters

| Parameter | Description | Data Type | Required |
| --- | --- | --- | --- |
| _expression_ | Column or expression to evaluate | Numeric | Yes |

#### Notes

-   When used as a window aggregate, include an `OVER (...)` clause.
-   Use `QUALIFY` (not `WHERE`) to filter rows based on a window calculation.

### Example

```sql
SELECT
    SUM(salary)
FROM
    rippling.employee.Employee
GROUP BY
    department;
```

Source: https://developer.rippling.com/documentation/rippling-platform/transformations/sql-reference/sum

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
