Datamart Query Data Aggregation Example

This example shows how the datamart_query_data tool aggregates Datamart data to identify the top customers by revenue. It includes the prompt, request, and response.

Prompt

List top 10 customers by revenue.

Request

JSON
{
  "uniqueName": "Standard_Sales_Data",
  "queryColumns": ["CustomerId", "CustomerName"],
  "aggregateColumn": "InvoicePrice",
  "aggregateMethod": "SUM",
  "top": true,
  "limit": 10
}

Response

Here are the top 10 customers by revenue (sum of Invoice Price, all time) from the Standard Sales Data datamart on the copilotfx partition, in EUR:

#

Customer ID

Customer Name

Revenue (EUR)

1

CID-0011

Stanley Linda CPA FR Ship-to 57

10,820,190

2

CID-0057

European Distributor DE Ship-to HE

10,711,177

3

CID-0004

Stanley Linda CPA US Ship-to IL

10,329,548

4

CID-0013

Stanley Linda CPA UK Ship-to Hulme

9,807,386

5

CID-0012

Stanley Linda CPA UK Sold-to Westminster

9,677,245

6

CID-0060

European Distributor FR Sold-to 96

9,585,152

7

CID-0055

European Distributor NL Ship-to DM

9,484,544

8

CID-0053

European Distributor NL Global customer GV

9,475,331

9

CID-0005

Stanley Linda CPA US Ship-to KY

9,229,814

10

CID-0010

Stanley Linda CPA FR Sold-to 8

9,206,205

The list is tightly clustered (roughly €9.2M–€10.8M) and dominated by two customer groups: Stanley Linda CPA (6 entries) and European Distributor (4 entries). Since these are individual ship-to/sold-to accounts, rolling them up to the parent customer group would show a much bigger gap between the two.

This covers all dates in the datamart. Should I narrow it to a specific period (e.g., the last 12 months) or aggregate by customer group instead?