# wavg {#wavg}

## Syntax {#syntax}

`wavg(value, weight)`

## Arguments {#arguments}

**value** is the value vector.

**weight** is the weight vector.

## Details {#details}

Calculate the weighted average of *X* with the weight vector *Y*. Please note that the weight vector *Y* is automatically scaled such that the sum of the weights is 1.

## Examples {#examples}

```
wavg(2.2 1.1 3.3, 4 5 6);
// output: 2.273333
//  (2.2*4+1.1*5+3.3*6)/(4+5+6)

wavg(1 NULL 1, 1 1 1);
// output: 1
```

Related function: [wsum](wsum.md)

