Skip to main content

When exporting raw data from a Table or Metric, you have the option of filtering rows using AND/OR logic within exportFilter. This article provides guidance and examples.

 

 

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

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:

     

  • Use OR nodes for filters fulfilling either condition:

  1. Use the Payload generator 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": "<uuid>", "modalityIds": ["<uuid>", ...] }

modalityIds must be non-empty.

Value

value

{ "metricId": "<uuid>", "condition": { "type": "<op>", "value": <typed> } }

<op> is one of LessThan, LessThanOrEqual, Equal, NotEqual, GreaterThan, GreaterThanOrEqual. condition.value must match the Metric’s data type (Number, Boolean).

And

and

[ <ExportFilter>, ... ]

Combine child filters with logical AND.

Or

or

[ <ExportFilter>, ... ]

Combine child filters with logical OR.

 

Examples

 

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

{
"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) OR (Revenue = 92):

{
"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:

{
"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
}
}
}
]
}
}

 

Be the first to reply!