mcpdata Request an invite

Answers / Analyse data

How do I get monthly totals from daily data with AI?

Recipe verified on Ran on the public demo (read-only)
Short answer

Ask your AI to group the rows by month and sum the value column, and give it a database to do it in. Over MCP it sends one structured query (group by the month, sum the revenue) and gets back one row per month, computed over every order, not a sample pasted into the chat.

Steps

  1. Connect your assistant to the public demo. It's a read-only instance with 10 million synthetic orders, so you can try this before you have your own. In Claude Code:
    claude mcp add --transport http mcpdata-demo https://demo.mcpdata.org/mcp --header "Authorization: Bearer cdb_live_PkVoldus8qcE-hqffjajNZzQwiA7rTHMoR4RLSAxsCE"

    The key is public on purpose: it can only read the demo's sample data. For Claude Desktop, Cursor and other apps, see Connect your AI.

  2. Ask your question. Give your AI this prompt:
    Using mcpdata, show total revenue per month from Demo.Orders, oldest month first.
What your AI does: the tool calls it makes for this prompt, and what came back
list_tables() → 3 tables: Demo.Orders, Demo.Products, Demo.Customers
describe_table(table_name="Demo.Orders") → 15 columns, 10,005,000 rows
query(table_name="Demo.Orders", group_by=["order_month"], agg=[{"func": "sum", "column": "revenue", "alias": "revenue"}, {"func": "count", "column": "order_id", "alias": "orders"}], sort=[{"column": "order_month", "desc": false}], limit=100) → 36 rows
0M59M117M176M235M2023-012023-052023-092024-012024-052024-092025-012025-052025-09
What you should get · the recipe's real result from its last run, first 12 of 36 rows
order_monthrevenueorders
2023-01113,275,870210,648
2023-02103,228,834192,393
2023-03115,381,862215,376
2023-04115,015,348215,018
2023-05119,810,840222,406
2023-06120,749,069225,040
2023-07137,709,259256,648
2023-08129,423,981242,035
2023-09123,704,588230,122
2023-10129,262,994241,317
2023-11141,445,842265,271
2023-12164,906,760307,936

Synthetic data: the demo's orders are generated, not real customers.

The assistant needs mcpdata connected (step 1) to run the query.

Why this works

Daily (or per-order) data is too long to paste into a conversation, and an AI adding up numbers it reads is slow and error-prone. A GROUP BY in the database is exact and returns only the 36 rows you need. Columns such as order_month make it a plain group-by; with raw timestamps the AI can ask for a month expression in a saved view.

Related questions