> For the complete documentation index, see [llms.txt](https://docs.inforiver.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.inforiver.com/formula-syntax/time-intelligence-functions/filter.md).

# FILTER

Filters measure values across a period based on specified conditions.

The **FILTER** formula filters measure values across a period range and returns only those values that meet the specified conditions. You need to combine the FILTER function with an aggregation function like SUM/AVG, etc. to get the required results.

## Syntax

```javascript
FILTER(measure, periodRange, condition1, [condition2],...)
```

## Arguments

measure – The measure to be filtered. Required.

periodRange – A period range array returned by the [PERIOD\_RANGE](/formula-syntax/date-functions/period_range.md) function. Required.

condition1, \[condition2], ... - Condition(s) that are used to check and filter (filter criteria). To refer to the current value, use the keyword **THIS**. Required.&#x20;

## Return value

Returns a range of measure values that satisfy the specified condition(s).

## Example

```javascript
FILTER([Sales], PERIOD_RANGE(DATE(2023,1,1),DATE(2023,12,31),THIS>1000)
//Returns the sales values for the year 2023 that are greater than 1000
```

In the sales report below, we combined the **FILTER** function with [**SUM**](/formula-syntax/math-functions/sum.md) to aggregate only the cells that meet a specific condition (>1000). We only sum up sales when they exceed 1000.

In the *Envelopes* row the sales for Q1 and Q4 meet the condition; those two cell values are returned by the FILTER function and added together.

The FILTER measure is blank for the *Fasteners* row because none of the cells have sales greater than 1000.

<figure><img src="https://3062809325-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEbkCXCUXmtUq5tcnUtZE%2Fuploads%2Fn7pzWPBMaSJx6YQDdS2O%2Fimage.png?alt=media&amp;token=5dcc15fa-ae87-4e17-965c-ab81b2fa0a7f" alt=""><figcaption><p>FILTER</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.inforiver.com/formula-syntax/time-intelligence-functions/filter.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
