---
title: "Math filters: How to target a specific field value with [gravitymath] filters"
date: 2026-04-23
author: "GravityKit"
link: "https://www.gravitykit.com/docs/gravitymath/how-to-target-a-specific-field-value-with-gvmath-filters/"
---

The "filter" parameter only works with `scope="view"` or `scope="form"` . More about that here: [The  Shortcode](https://www.gravitykit.com/docs/gravitymath/math-shortcode/).

Assuming you have a form like this one:

![Dropdown for calculation, inputs for numbers, auto sum total, and submit button](https://www.gravitykit.com/wp-content/uploads/2025/10/file-5uPpTBdiub.png)
*...and a View like this one:*![Table with columns: Calculate, Number 1, Number 2; showing Yes/No and numeric data for calculations](https://www.gravitykit.com/wp-content/uploads/2025/10/file-DSQ3TePMYq.png)Now, you want to calculate the sum between Number 1 and Number 2, only for the entries where the value of the Calculate field is "Yes". That's now possible with the "filter" parameter of the  shortcode.

Here's our shortcode. Make sure to replace the View ID (`8` in this example) and the View secret (`abc123` in this example) with the ID and [secret](https://www.gravitykit.com/docs/gravityview/getting-started-gravityview/enable-enhanced-security-the-secret-attribute-for-shortcodes/) for your View.

```
Total: [gravitymath scope="view" secret="abc123" id="8" filter="filter_1=Yes&op_1=is"]{Number 1:2}+{Number 2:3}[/gravitymath]
```

```
Total: [gravitymath scope="view" secret="abc123" id="8" filter="filter_1=Yes&op_1=is"]{Number 1:2}+{Number 2:3}[/gravitymath]
```

...and here's the output in the View:

![Highlighted rows show calculations with totals summed to 26](https://www.gravitykit.com/wp-content/uploads/2025/10/file-OmCmE1PWb3.png)

### Usage

The following attributes for the "filter" parameter are supported:

- `filter_N` - the filter, where N is the ID of the field or meta key
- `op_N` - the operation for a corresponding `filter_N` , default: `is` , other operators are `isnot` , `contains` , `notcontains` , `lt` (less than), and `gt` (greather than).
- `limit` - the number of entries to calculate. Leave it blank to use all entries from the chosen "scope" parameter.

In the example below, we filter the field Calculate (ID = 1) for the "Yes" value.

```
[gravitymath scope="view" id="206" secret="abc123" filter="filter_1=Yes&op_1=is"]...[/gravitymath]
```

```
[gravitymath scope="view" id="206" secret="abc123" filter="filter_1=Yes&op_1=is"]...[/gravitymath]
```

If we wanted to filter by two fields instead, for example, Calculate =Yes and Number 2 = 6, then we'll do it like this:

```
[gravitymath scope="view" id="206" secret="abc123" filter="filter_1=Yes&op_1=is&filter_3=Yes&op_3=is"]...[/gravitymath]
```

```
[gravitymath scope="view" id="206" secret="abc123" filter="filter_1=Yes&op_1=is&filter_3=Yes&op_3=is"]...[/gravitymath]
```

Pay attention to the fact that filter\_1 and op\_1 correspond to the first field Calculate (ID = 1), and filter\_3 and op\_3 correspond to the field Number 2 (where ID = 3).

### Use values on the filter parameter, not labels

If you are filtering a choice-based field, like a dropdown, that uses values instead of only labels, then the filter will look for the value and not the label:

![Choices field settings with labels and values, showing ](https://www.gravitykit.com/wp-content/uploads/2025/10/file-643yznNs4l.png)
*Example:*
```
[gravitymath ... filter="filter_1=first_choice"]...[/gravitymath]
```

```
[gravitymath ... filter="filter_1=first_choice"]...[/gravitymath]
```

### Filtering by dates

The filter parameter also accepts dates in the same format specified in the form editor or in the YYYY-MM-DD format.

![WordPress editor with GravityMath shortcode for calculating form field totals](https://www.gravitykit.com/wp-content/uploads/2025/10/file-5861YvSV3P.png)
*![Table lists names, dates, and numbers with links. Total number displayed is 7](https://www.gravitykit.com/wp-content/uploads/2025/10/file-2RMjH72zui.png)*