---
title: "DSAVG"
url: "https://help.formsfly.com/en/article/dsavg"
language: "en"
last_updated: "2024-11-11T11:03:25.506Z"
---

# DSAVG

Averages column values in the given Data Source, optionally filtering rows by formula.

### Syntax

`**DSAVG(dsId, columnIndex, 'optionalFilterFormula')**`

### Example

```plaintext
DSAVG('STAFF', 2) averages the 3rd column's values

Add a filter formula using {{this[column]}} to refer to columns.
DSAVG('STAFF', 2, '{{this[5]}} = "BOB"') averages 3rd column where 6th column = BOB
```

### Notes

Refer to the Data Source by its External Id (from the Data Source -> Settings page).  
Refer to the column by its zero-based index.

### Related 

[DSCOUNT](https://help.formsfly.com/en/article/dscount), [DSSUM](https://help.formsfly.com/en/article/dssum), [DSMAX](https://help.formsfly.com/en/article/dsmax), [DMIN](https://help.formsfly.com/en/article/dsmin), [DSFIRST](https://help.formsfly.com/en/article/dsfirst), [DSLAST](https://help.formsfly.com/en/article/dslast)
