---
title: "DSMAX"
url: "https://help.formsfly.com/en/article/dsmax"
language: "en"
last_updated: "2024-11-11T11:01:58.051Z"
---

# DSMAX

Gets maximum column value in the given Data Source, optionally filtering rows by formula.

### Syntax

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

### Example

```plaintext
DSMAX('STAFF', 2) gets 3rd column's max value

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

### Notes

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

### Related 

[DSCOUNT](https://help.formsfly.com/en/article/dscount), [DSSUM](https://help.formsfly.com/en/article/dssum), [DSMIN](https://help.formsfly.com/en/article/dsmin), [DSAVG](https://help.formsfly.com/en/article/dsavg), [DMIN](https://help.formsfly.com/en/article/dsmin), [DSLAST](https://help.formsfly.com/en/article/dslast)
