---
title: "How exportFilter works for Table and Metric exports"
slug: "how-exportfilter-works-for-table-and-metric-exports"
tags: ["Export Filter", "Importing and Exporting Data ", "Metric Queries"]
updated: 2025-10-15T10:57:45Z
published: 2025-10-15T10:57:45Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://kb.pigment.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How exportFilter works for Table and Metric exports

Use `exportFilter` to filter rows when exporting a Table or a Metric. It lets you combine Dimension and value conditions with AND/OR logic. For example, for a “Revenue” Metric with Dimensions “Month” and “Account”, you can build queries like:

- Filter on Month = [”May 2025”] **AND** Revenue ≥ 100,000
- Filter on Month = [”May 2025”] **AND** (Revenue ≥ 100,000 **OR** Account = [”Acme Inc”, …])

> [!NOTE]
> ℹ️ Note
> 
> The legacy `filters` field is deprecated. If you send both `filters` and `exportFilter`, they’re combined with an implicit AND.

## How to write the `exportFilter` query tree

1. Sketch out your `exportFilter` logic as a recursive tree. Every node needs a `type`:

- Use a **Dimension** node to filter on Dimension values (for example, filter on specific Months or Accounts)
- Use a **Value** node to filter on the value of a Metric (for example, filter on Revenue ≥ 100,000 or Boolean = TRUE)
- Use **AND******nodes for filters fulfilling both conditions:

![](https://uploads-eu-west-1.insided.com/pigment-en/attachment/6d2b5594-c107-4db1-92f6-b7319086d666.png)
- Use **OR******nodes for filters fulfilling either condition:

![](https://uploads-eu-west-1.insided.com/pigment-en/attachment/337a4b3d-35a4-4d4a-87dd-2907f58d9e29.png)

1. Use the [Payload generator](/v1/docs/raw-data-block#generate-a-payload-to-obtain-pigment-block-ids) to create a basic payload for your Table or Metric.
2. Use the following sections on types and examples to edit your payload with the correct syntax for your needs.

## Required keys by type

| `type` | Payload key you must set | Shape | Notes |
| --- | --- | --- | --- |
| `Dimension` | `dimension` | `{ "dimensionId": "&lt;uuid&gt;", "modalityIds": ["&lt;uuid&gt;", ...] }` | `modalityIds` must be non-empty. |
| `Value` | `value` | `{ "metricId": "&lt;uuid&gt;", "condition": { "type": "&lt;op&gt;", "value": &lt;typed&gt; } }` | `&lt;op&gt;` is one of `LessThan`, `LessThanOrEqual`, `Equal`, `NotEqual`, `GreaterThan`, `GreaterThanOrEqual`. `condition.value` must match the Metric’s data type (Number, Boolean). |
| `And` | `and` | `[ &lt;ExportFilter&gt;, ... ]` | Combine child filters with logical AND. |
| `Or` | `or` | `[ &lt;ExportFilter&gt;, ... ]` | Combine child filters with logical OR. |

## Examples

In the following example, Boolean = true AND Revenue = 91:

```css
{
  "metrics": [
    "11111-2222-3333", // BOOLEAN METRIC
    "44444-5555-6666" // NUMBER METRIC
  ],
  "friendlyHeaders": true,
  "dateFormat": "Iso8601",
  "fieldDelimiter": "Comma",
  "exportFilter": {
    type: "AND",
    and: [
      {
        type: "value",
        value: {
          metricId: "11111-2222-3333",
          condition: {
            type: "Equal",
            value: true
          }
        }
      },
      {
        type: "value",
        value: {
          metricId: "44444-5555-6666",
          condition: {
            type: "Equal",
            value: 91
          }
        }
      }
    ]
  }
}
```

  

In the next example, (Boolean = true AND Revenue = 91) O

R (Revenue = 92):

  

```css
{
  "metrics": [
    "11111-2222-3333",
    "44444-5555-6666"
  ],
  "friendlyHeaders": true,
  "dateFormat": "Iso8601",
  "fieldDelimiter": "Comma",
  "exportFilter": {
    "type": "OR",
    "or": [
      {
        "type": "AND",
        "and": [
          {
            "type": "value",
            "value": {
              "metricId": "11111-2222-3333",
              "condition": {
                "type": "Equal",
                "value": true
              }
            }
          },
          {
            "type": "value",
            "value": {
              "metricId": "44444-5555-6666",
              "condition": {
                "type": "Equal",
                "value": 91
              }
            }
          }
        ]
      },
      {
        "type": "value",
        "value": {
          "metricId": "44444-5555-6666",
          "condition": {
            "type": "Equal",
            "value": 92
          }
        }
      }
    ]
  }
}
```

In the next example, Month = July 25 OR Revenue = 92:

```css
{
  "metrics": [
    "11111-2222-3333",
    "44444-5555-6666"
  ],
  "friendlyHeaders": true,
  "dateFormat": "Iso8601",
  "fieldDelimiter": "Comma",
  "exportFilter": {
    "type": "OR",
    "or": [
      {
        "type": "dimension",
        "dimension": {
            "dimensionId": "77777-8888-9999",
            "modalityIds": ["22222-3333-4444"]
          }
      },
      {
        "type": "value",
        "value": {
          "metricId": "44444-5555-6666",
          "condition": {
            "type": "Equal",
            "value": 92
          }
        }
      }
    ]
  }
}
```
