Microsoft Fabric Updates Blog

Introducing Aggregations in Fabric API for GraphQL: Query Smarter, Not Harder

Summarize, group, and explore data in one step with the new GraphQL aggregations feature

We’re excited to launch a powerful new capability in the Fabric API for GraphQL—Aggregations. This feature brings native support for summary-level insights directly into your GraphQL queries, making your data exploration faster, simpler, and more efficient.

Why Aggregations?

Until now, getting summary metrics like totals, averages, or counts required workarounds—either writing custom logic or running multiple queries and doing the math client-side. Aggregations change that.

Now you can:

  • Query KPIs and summary values directly from your API.
  • Use filtering, slicing, and grouping with the new group by argument.
  • Build dashboards and apps that load faster with fewer queries.

The new aggregation operations include:

  • count – Count of records (or non-null values of a field) in the group.
  • sum – Sum of all values in a numeric field.
  • avg – Average (mean) of values in a numeric field.
  • min – Minimum value in a field.
  • max – Maximum value in a field.

How It Works

With Aggregations, you can use the new groupBy argument on a queryable field to group data and apply functions like sum, avg, and count in a single query.

Example 1: Total Products by Category

query {
  products {
   groupBy(fields: [category_id]) 
   {
      fields {
         category_id # grouped key values
      }
      aggregations {
        count(field: id) # count of products in each group (count of "id")
     } 
   }
  }
}

This returns aggregated results grouped by category, similar to what you might see in a pivot table.

{
  "data": {
    "products": {
      "groupBy": [
        {
          "fields": {
            "category_id": 1
          },
          "aggregations": {
            "count": 3
          }
        },
        {
          "fields": {
            "category_id": 2
          },
          "aggregations": {
            "count": 2
          }
        },
      ...
      ]
    }
  }
}

Example 2: Calculate sum of prices and average ratings

query {
  products {
   groupBy(fields: [category_id]) 
   {
      fields {
         category_id
      }
     aggregations {
        count(field: id)   # number of products in the category
        sum(field: price)  # total of all product prices in the category
        avg(field: rating) # average rating of products in the category
     } 
   }
  }
}

In addition to counting, you can also calculate sums and averages for different fields group by product categories:

{
  "data": {
    "products": {
      "groupBy": [
        {
          "fields": {
            "category_id": 1
          },
          "aggregations": {
            "count": 3,
            "sum": 2058.98,
            "avg": 4
          }
        },
        {
          "fields": {
            "category_id": 2
          },
          "aggregations": {
            "count": 2,
            "sum": 109.94,
            "avg": 4
          }
        },
        ...
      ]
    }
  }
}

Built for Simplicity and Scale

Just like the rest of Fabric API for GraphQL, Aggregations are strongly typed and schema-aware. You get discoverable field names and backend query optimizations — all with the flexibility of GraphQL.

Try It Today

Aggregations are available now for supported data sources via Fabric API for GraphQL. You can find more information about Fabric GraphQL Aggregations, including additional examples, in our documentation.

Ready to summarize your data faster? Give the aggregations feature a try and let us know what you think! Submit your feedback to Fabric Ideas.

相關部落格文章

Introducing Aggregations in Fabric API for GraphQL: Query Smarter, Not Harder

11月 10, 2025 作者: Arun Ulagaratchagan

SQL is having its moment. From on-premises data centers to Azure Cloud Services to Microsoft Fabric, SQL has evolved into something far more powerful than many realize and it deserves the focused attention of a big stage.  That’s why I’m thrilled to announce SQLCon, a dedicated conference for database developers, database administrators, and database engineers. Co-located with FabCon for an unprecedented week of deep technical content … Continue reading “It’s Time! Announcing The Microsoft SQL Community Conference”

11月 3, 2025 作者: Arshad Ali

Additional authors – Madhu Bhowal, Ashit Gosalia, Aniket Adnaik, Kevin Cheung, Sarah Battersby, Michael Park Esri is recognized as the global market leader in geographic information system (GIS) technology, location intelligence, and mapping, primarily through its flagship software, ArcGIS. Esri empowers businesses, governments, and communities to tackle the world’s most pressing challenges through spatial analysis. … Continue reading “ArcGIS GeoAnalytics for Microsoft Fabric Spark (Generally Available)”