# filters Properties

Use the `filters` property to add a filter to a step query. Although you can create filters for query steps in the user interface, you have to manually define filters for static steps in the dashboard JSON.

The syntax for a filter in the step definition varies based on whether the step is in compact or SAQL form. This section describes the filter syntax for compact-form steps, including a description and example of every operator. For information about the filters for SAQL-form steps, see the [Analytics SAQL Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.bi_dev_guide_saql.meta/bi_dev_guide_saql/bi_saql_intro.htm).

## Filter Syntax for Compact Form 2.0

Filters defined in compact-form steps have the following syntax.

```nolang
"filters": [[
    "field",
    [value],
    "operator"
]]
```

## Example Filter

For example, the following filter shows only records where `Sales` is between `1` and `100,000` and `Customer_Segment` is either `Consumer` or `Corporate`.

```nolang
"filters": [
    [
        "Sales",
        [
          1,
          100000
        ],
        ">=<="
    ],
    [
        "Customer_Segment",
        [
          "Consumer"
          "Corporate"
        ],
        "in"
    ]
]]

```

## Dimension Filter Examples

```nolang

   "filters": [Region", ["East", "West"], "in"]
   "filters": [Region", ["st"], "matches"]
   "filters": [Region", [], "isnull"]
   "filters": [["year", "OrderDate"], [2020, 2022], "in"]

```

## Measure Filter Examples

```nolang

   "filters": ["Profit", [], "isnull"]
   "filters": ["Profit", [1], ">="]
   "filters": ["Profit", [1, 100], ">=<="]

```

## Absolute Date Filter Examples

```nolang

   "filters": ["OrderDate", ["2019-10-12", "2019-10-22"], "between"
   "filters": ["OrderDate", ["2019-10-12", null], "between"]
   "filters": ["OrderDate", [null, "2019-10-22"], "between"]

```

## Relative Date Filter Examples

```nolang

   "filters": ["OrderDate", [[fiscal_year", -1], ["day", 0]], "between"]]"between"]

```

## Compound Filter and Compound Date Filter in a Time-zone Enabled Org Example

```nolang
"filters": [
    [
        [
          "Type",
          "LeadSource"
        ],
        [
          "Existing Business",
          "Advertisement"
        ],
        "in"
    ]
    [
        [
          ["year", "CloseDate"],
          ["quarter", "CloseDate"]
        ],
        [
          [2020, 2],
          [2021, 3]
        ],
        "in"
    ]
]

```

## Filter Syntax for Compact Form 1.0

Filters defined in compact-form steps have the following syntax.

```nolang
"filters": [[
    "field",
    [value],
    "operator"
]]
```

For example, the following filter shows only records with a “Customer” account type.

```nolang
"filters": [[
    "Account_Type",
    ["Customer"],
    "in"
]]
```

To compare against multiple values, include the values in an array, like this.

```nolang
"filters": [[
    "field",
    [[value1, value2, value3]],
    "operator"
]]
```

To specify an absolute date value for a date filter, specify the value in epoch format, where the value is the number of milliseconds since January 1, 1970 midnight UTC (1970-01-01 00:00:00). The following example shows dataset rows with a close date on or before January 1, 2016.

```nolang
"filters": [[
    "Close Date",
    [[
        1451606400000,
        null
    ]],
    ">="
]]
```

## Operators

You can use different operators in a filter. The supported operators depend on the field type. If you don’t specify the operator, Analytics applies the `==` operator.

| Operator                                                        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Compact-Form 2.0 Example                                                                                                                                                    | Compact-Form 1.0 Example                                                                                                                                                                                                |   |
| --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
| `in`                                                            | Value of dataset field equals one of the specified values. Applies to dimensions only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | `["Dimension",["Value1","Value2"],"in"]`                                                                                                                                    | `["Dimension",["Value1","Value2"],"in"]`                                                                                                                                                                                |   |
| `not in`                                                        | Value of dataset field is not in the specified list of values. Applies to dimensions only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | `["Dimension",["Value1","Value2"],"not in"]`                                                                                                                                | `["Dimension",["Value1","Value2"],"not in"]`                                                                                                                                                                            |   |
| `matches`                                                       | Value of dataset field contains the specified value. This operator is not case-sensitive. Applies to dimensions only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `["Dimension",["Val"],"matches"]`                                                                                                                                           | `["Dimension",["Val"],"matches"]`                                                                                                                                                                                       |   |
| `is null`                                                       | Value of dataset field is null. Applies to measures, dimensions and absolute dates in Compact form 2.0 and to measures only in Compact form 1.0.                                                                                                                                                                                                                                                                                                                                                                                                                                                    | `["Measure",[],"isnull"]`                                                                                                                                                   | `["Measure",[[]],"isnull"]`                                                                                                                                                                                             |   |
| `is not null`                                                   | Value of dataset field is not null. Applies to measures, dimensions and absolute dates in Compact form 2.0 and to measures only in Compact form 1.0.                                                                                                                                                                                                                                                                                                                                                                                                                                                | `["Measure",[],"isnotnull"]`                                                                                                                                                | `["Measure",[[]],"isnotnull"]`                                                                                                                                                                                          |   |
| `==`                                                            | Value of dataset field equals the specified value. Applies to measures only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | `["Measure",[1],"=="]`                                                                                                                                                      | `["Measure",[[1]],"=="]`                                                                                                                                                                                                |   |
| `!=`                                                            | Value of dataset field does not equal the specified value. Applies to measures only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | `["Measure",[1],"!="]`                                                                                                                                                      | `["Measure",[[1]],"!="]`                                                                                                                                                                                                |   |
| `<`                                                             | Value of dataset field is less than the specified value. Applies to measures only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | `["Measure",[10],"<"]`                                                                                                                                                      | `["Measure",[[10]],"<"]`                                                                                                                                                                                                |   |
| `>`                                                             | Value of dataset field is greater than the specified value. Applies to measures only.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | `["Measure",[1],">"]`                                                                                                                                                       | `["Measure",[[1]],">"]`                                                                                                                                                                                                 |   |
| `<=`                                                            | Value of dataset field is less than or equal to the specified value. Applies to measures only in Compact form 2.0 and to measures and absolute dates only in Compact form 1.0.                                                                                                                                                                                                                                                                                                                                                                                                                      | `["Measure",[10],"<="]`                                                                                                                                                     | <ul><li>`["Measure",[[10]],"<="]`</li><li>`["Date",[[1229040000000]],"<="]`</li></ul>                                                                                                                                   |   |
| `>=`                                                            | Value of dataset field is greater than or equal to the specified value. Applies to measures only in Compact form 2.0 and to measures and absolute dates only in Compact form 1.0.                                                                                                                                                                                                                                                                                                                                                                                                                   | `["Measure",[1],">="]`                                                                                                                                                      | <ul><li>`["Measure",[[1]],">="]`</li><li>`["Date",[[-374457600000]],">="]`</li></ul>                                                                                                                                    |   |
| `>=<=` or `between` with measures and dates in Compact form 1.0 | Value of dataset field is between the specified values, inclusive. For relative dates, you can specify the following time periods: "year", "quarter", "month", "week", and "day". Applies to measures only in Compact form 2.0 and measures and dates only in Compact form 1.0. You can also use these operators with measures in Compact form 2.0 and measures and dates in Compact form 1.0: <ul><li>>=< (Greater than or equal to one value, but less than another)</li><li>><= (Greater than one value, but less than or equal to another)</li><li>>< (Between two values, exclusive)</li></ul> | `["Measure",[1,10],">=<="]`                                                                                                                                                 | <ul><li>`["Measure",[[1,10]],">=<="]`</li><li>`["Date",[[-374457600000,1229040000000]],">=<="]`</li><li>`["Date",[[["month",-1],["month",1]]],">=<="]`</li><li>`["Close Date", [[null,1451606400000]],"<="]]`</li></ul> |   |
| `between` with dates in Compact form 2.0                        | Value of dataset field is between the specified values, inclusive. For relative dates, you can specify the following time periods: "year", "quarter", "month", "week", and "day".                                                                                                                                                                                                                                                                                                                                                                                                                   | <ul><li>`["Date",[null, 1388448000000], "between"]`</li><li>`["Date",[1388448000000, null], "between"]`</li><li>`["Date",[["year", -1], ["year", 1]], "between"]`</li></ul> |                                                                                                                                                                                                                         |   |

To view a complete example with a binding syntax, see the [Bind the Initial Filter Selection](https://developer.salesforce.com/docs/analytics/bi-dev-guide-bindings/guide/bi-dashboard-bindings-wave-designer-initial-selections.md) documentation.
