# contextSum {#contextsum}

## Syntax {#syntax}

`contextSum(X, Y)`

## Arguments {#arguments}

**X** and **Y** are vectors, matrices or tables.

## Details {#details}

Get of positions that are not null in both *X* and *Y*, and calculate the sum of the elements in *X* on these positions.

## Examples {#examples}

```
contextSum(1 2 3 4 5, 2 3 4 5 6)
// output: 15

contextSum(1..3, true false true)
// output: 6

contextSum(1 2 NULL, 1 NULL 3)
// output: 1
```

Related functions: [contextCount](contextCount.md), [contextSum2](contextSum2.md)

