--- title: "BuildAggregate" slug: "buildaggregate" updated: 2024-12-02T18:27:19Z published: 2024-12-02T18:27:19Z canonical: "docs.datajet.app/buildaggregate" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.datajet.app/llms.txt > Use this file to discover all available pages before exploring further. # BuildAggregate Creates a summary field by aggregating data from a foreign table onto a primary table. | Key | Value(s) | Description | | --- | --- | --- | | method | "BuildAggregate" | Creates a summary field by aggregating data from a foreign table onto a primary table. | | project | "#project#" | | | targetTable | "tableName" | required. Table on which to create the field. | | source | "SourceTableName.SourceFieldName" | Required. Full name of field to aggregate. | | function | "min/max/sum/count/avg" | - min - max - sum - count - avg | | name | "FieldName" | Required. | | dataSet | {} | Optional. If provided, source field will be filtered to include only records in the [dataset](/v1/docs/dataset). | | overwrite | true/false | Optional. Default = false If true, existing field will be over-written. If false and field exists, error will be raised. | | forceLong | true/false | | ```json { "method": "BuildAggregate", "project": "MyProject", "targetTable": "customer", "source": "transactions.profit", "overwrite": true, "name": "total profit", "function": "sum" } ``` ```json { "method": "BuildAggregate", "project": "#project#", "targetTable": "", "source": "", "function": "", "name": "", "dataSet": {}, "overwrite": false, "forceLong": false } ```