FROM and SHOW
Every query starts with FROM and the object to report on, followed by SHOW and the numbers you want.
FROM dealsSHOW count, value, won_valueFROM <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 dealsSHOW won_value * 12 AS ARR, won_value / won_count AS avg_won, won_count * 100 / count AS win_pctGROUP BY ownerDividing 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.
Related metrics
Section titled “Related metrics”When the object can be combined, show the metrics of linked records next to its own:
FROM contactsSHOW count, deals.count, deals.won_value, orders.totalGROUP BY sourceEach object keeps its own permissions and data visibility.
Examples
Section titled “Examples”-- Revenue and order count this monthFROM ordersSHOW total, countDURING this_month-- Average won deal per ownerFROM dealsSHOW won_value / won_count AS avg_wonGROUP BY ownerDURING this_yearON won_at