Ir al contenido

Aggregate data

Esta página aún no está disponible en español. Se muestra la versión en inglés.

Turn thousands of rows into the handful of numbers you need, split the way you need them, and check that the query counted what you meant.

  • Permissions: anyone who’s signed in can ask the Librarian. Building a summary in a project needs edit access to that project.
  • Data you need: a table with a number to add up and something to split it by. The examples use Curio’s square_transactions, with each sale’s total, its store in location_id and its time in created_at.
  • Credits this uses: each question to the Librarian, or in a project, uses a credit. Refining a result uses half of one.

Every summary has two parts: the number, like a total, a count or an average, and what it’s split by, like month or store. Name both, and the dates.

VagueClear
”Sales by store""Total Square sales by store (location_id), January to September 2025"
"How many customers?""How many distinct customers placed a Shopify order in 2025?”

Two choices trip people up. A count counts rows, so say “distinct” when you mean people or orders. And an average gets pulled around by a few huge values, so ask for the median as well when your data has them. Asking good questions has more on wording.

Librarian chat is fine for one number or one split. The answer shows the rows, with Show the query under them.

When you want a trend, several cuts of the same number, a chart or an export, use a project. The Librarian offers a This needs a project card with Create project when a question needs one. In a project, a summary runs as a Data Query step that you can run again later.

3. Ask for several numbers per group at once

Section titled “3. Ask for several numbers per group at once”

One request can return several numbers for each group:

For each Square store (location_id), show total sales, the number of transactions and the average sale, January to September 2025.

Why ask for them together? Two stores can have the same total, one from lots of small sales and one from a few big ones. Side by side, you see the difference straight away.

To see one number across two splits, like stores by month, ask for one of them as columns:

Show total Square sales in 2025 with stores as rows and months as columns.

Check the layout that comes back. If you get one row per store and month instead, click Refine on the result and ask for months as columns.

A total rarely answers the question on its own. Ask for what you’ll actually compare:

  • a share of the total, like “What share of 2025 Square sales came from each store?”
  • a ratio, like “Average sale per transaction by month, 2025”
  • growth, like “Month-over-month change in Square sales, January to September 2025”

Say what a ratio divides by. “Average order value” can mean revenue over all orders, or over orders that weren’t refunded. If your team has settled it, write the rule down.

“Top 10 stores by 2025 sales” is a fine question. Averages need more care, because a group with two big sales can top an average list. Ask for the number of rows beside any average, such as “average sale by store, with the number of transactions”.

  • For a chart, ask in the project, like “Chart monthly Square sales for 2025 as a line”. It adds a Visualization step.
  • For a file, point at the result card, click Download and pick CSV, Excel, Parquet or Markdown. For a formatted workbook, ask for an Excel Export.
  • For a dashboard, click Add to Dashboard on the result. It updates when the project runs again, not by itself. See Keep data fresh.
  • Show the query groups by the split you asked for, and its dates and filters match your question.
  • It uses the right calculation: a sum, a count, an average, or a distinct count for people and orders.
  • The groups add up to the total you’d expect.
  • Each group has enough rows behind it to trust its average.

The total doesn’t match another report. Compare the dates and filters in the query, and check whether refunds, cancellations or duplicate rows are counted. Currencies matter too: Curio’s NetSuite invoices come in more than one currency, so a plain sum of total mixes them. Ask for totals by currency instead.

A count is too high. It counted rows. Ask for distinct customers or orders.

There are too many groups. Split by something broader, like region instead of store, or keep the top 10.

The percentages don’t add up to 100. Rounding can do it, and so can rows with a blank split value, or a filter applied to the parts but not the total. Ask for the counts beside the percentages.

The last month looks low. It may not be a complete month. See Work with dates.