## WEIGHTED_AVG

Calculates the weighted average of a numeric expression.

## Syntax

`WEIGHTED_AVG(number, weight)`

### Parameters

#### `number`

A numeric value.

#### `weight`

A numeric weight.

## Examples

```esql
FROM employees
| STATS w_avg = WEIGHTED_AVG(salary, height) BY languages
| EVAL w_avg = ROUND(w_avg)
| KEEP w_avg, languages
| SORT languages
```

This example calculates the weighted average of employee salaries using their heights as weights, grouped by languages. The result is rounded and sorted by language.