Skip to content

Every query starts with FROM and the object to report on, followed by SHOW and the numbers you want.

FROM deals
SHOW count, value, won_value
FROM <object>

FROM takes one object: deals, contacts, invoices, orders, subscriptions and so on. The Objects page lists them all, with what each one holds and whether it can be combined with others.

SHOW <metric>[, <metric> ...]

SHOW takes one or more metrics, separated by commas.

Form Example Result
A metric of the object SHOW count, won_value The catalog metric
A related object’s metric SHOW deals.won_value The metric of the linked records
Renamed SHOW won_value AS revenue The column is called revenue
Scaled SHOW won_value * 12 AS ARR The metric times a number
Math SHOW won_value / won_count AS avg_won A calculated metric
A function of a field SHOW avg(amount), sum(mrr) See Functions

Combine metrics with + - * / and parentheses:

FROM deals
SHOW won_value * 12 AS ARR,
won_value / won_count AS avg_won,
won_count * 100 / count AS win_pct
GROUP BY owner

Dividing by zero shows an empty value. In tables, a calculated rate is totaled from its parts, so the totals row stays correct. Money stays money: won_value / won_count is shown as currency, while won_value / value is a plain number.

When the object can be combined, show the metrics of linked records next to its own:

FROM contacts
SHOW count, deals.count, deals.won_value, orders.total
GROUP BY source

Each object keeps its own permissions and data visibility.

-- Revenue and order count this month
FROM orders
SHOW total, count
DURING this_month
-- Average won deal per owner
FROM deals
SHOW won_value / won_count AS avg_won
GROUP BY owner
DURING this_year
ON won_at