**Type**: Function

**Function**: `SUM`

**Syntax**: `SUM(field or expression)`

**Description**: Sums a field or expression over all records, for each grouping (set of dimensions).

**Sample usage**:

`SUM(additions)`

returns the sum of the`additions`

field value, for each grouping. This calculation will return the total number of lines of code added in each grouping (e.g. per month).`SUM(1)`

is equivalent to`COUNT()`

and returns the number of records in each grouping.`SUM(CONTAINS(label_names, "bug") ? 2 : 1)`

is a weighted count where records labeled as “bug” weigh twice as much as other records.