Aggregate

Learn how to read board data using grouped summaries and aggregation functions using the platform API

Aggregation summarizes large amounts of data into fewer, more meaningful values, helping you interpret work data at a glance.

It combines multiple rows into a smaller set of data points. For example, a marketing director with a monday.com board of campaigns can use aggregation to find the average campaign cost across the board.

Aggregation functions define how data is calculated (e.g., AVERAGE for averages, COUNT_ITEMS for totals). You can also apply filters to focus on specific subsets (e.g., campaigns launched in the last 6 months) or use grouping to summarize items by a shared column (e.g., average cost per marketing manager).

👍

Performance benefit: Aggregate queries use significantly less complexity than equivalent item queries. In testing, an aggregate query on a 1,368-item board cost 110 complexity points compared to 5,520+ points for fetching the same data via items_page. See the aggregation guide for details.

Queries

Get aggregate

  • Returns an array of aggregated results; returned values are pre-processed (no client-side data handling needed)
  • Must be queried directly at the root; can't be nested within another query

Basic example

Count items and calculate the average of a numbers column:

query {
  aggregate(query: {
    from: { type: TABLE, id: 1234567890 },
    select: [
      {
        type: FUNCTION,
        function: { function: COUNT_ITEMS },
        as: "total_items"
      },
      {
        type: FUNCTION,
        function: {
          function: AVERAGE,
          params: [{ type: COLUMN, column: { column_id: "numbers" }, as: "numbers" }]
        },
        as: "avg_value"
      }
    ]
  }) {
    results {
      entries {
        alias
        value {
          ... on AggregateBasicAggregationResult { result }
        }
      }
    }
  }
}

Group by example

The following example returns the sum of story points per person, filtering to include only items where the status column is set to "Done".

query {
  aggregate(query: {
    from: { type: TABLE, id: 1234567890 },
    group_by: [{ column_id: "task_owner", limit: 10 }],
    query: {
      rules: [{
        operator: any_of,
        column_id: "status",
        compare_value: [1]
      }]
    },
    select: [
      {
        type: FUNCTION,
        function: {
          function: SUM,
          params: [{ type: COLUMN, column: { column_id: "task_estimation" }, as: "task_estimation" }]
        },
        as: "sum"
      },
      {
        type: COLUMN,
        column: { column_id: "task_owner" },
        as: "task_owner"
      }
    ]
  }) {
    results {
      entries {
        alias
        value {
          ... on AggregateGroupByResult { value }
          ... on AggregateBasicAggregationResult { result }
        }
      }
    }
  }
}
📘

Group by value formats: The value field in AggregateGroupByResult returns raw values whose format depends on the column type. Status columns return hex color codes (e.g., "#00c875"), people columns return IDs (e.g., "person-12345"), date columns return epoch timestamps in milliseconds, and checkbox columns return booleans. See the aggregation guide for a full mapping.

Arguments

ArgumentTypeDescription
queryAggregateQueryInput!The aggregation query to execute. Defines the data source, groupings, filters, and fields to aggregate.

Fields

FieldTypeDescription
results[AggregateResultSet!]The result of the aggregated query.

Supported functions

Aggregation functions

These functions reduce a set of values to a single result.

FunctionDescriptionRequires columnExample use case
COUNT_ITEMSCounts total itemsNoTotal tasks on a board
COUNT_SUBITEMSCounts total subitemsNoTotal subtasks across items
COUNTCounts items with non-null values in a columnYesHow many items have estimates
COUNT_DISTINCTCounts distinct values in a columnYesNumber of unique text categories
SUMSums numeric valuesYesTotal story points
AVERAGECalculates the meanYesAverage deal size
MEDIANFinds the median valueYesMedian completion time
MINFinds the minimum valueYesEarliest date, lowest score
MAXFinds the maximum valueYesLatest date, highest score

Transformative functions

These functions transform column values for use in group_by operations. The as alias of the transformative function must match the column_id in the group_by array.

FunctionDescriptionExample use case
DATE_TRUNC_DAYTruncates dates to dayGroup items by day
DATE_TRUNC_WEEKTruncates dates to weekWeekly item counts
DATE_TRUNC_MONTHTruncates dates to monthMonthly summaries
DATE_TRUNC_QUARTERTruncates dates to quarterQuarterly reports
DATE_TRUNC_YEARTruncates dates to yearYear-over-year comparison

Use cases

  • Dynamic query generation: Turn user input into structured aggregation queries for dashboards, charts, and summaries.
  • On-demand insights: Give teams instant visibility into workload, activity, or bottlenecks through automated queries.
  • Custom reporting via API: Build third-party reports and visualizations without client-side aggregation.
  • Self-serve intelligence: Enable automations and internal tools to access grouped metrics programmatically.
  • Complexity optimization: Replace multi-page item queries with a single aggregate call, reducing API complexity costs by 50-150x.