> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://mammoth.io/docs/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# Create metrics and KPIs in the Mammoth Metrics panel

> Create single-value metrics in Mammoth from a column header or the Metrics panel: Sum, Average, formulas or AI-written SQL, with currency, percent and lock options.

The **Metrics** panel calculates single numbers from your columns, such as total revenue, average deal size or defect rate. Open it from the **Metrics** icon in the data editor's action bar, or create one from a number column's header with **Create Metric**. Metrics update as you filter with Explore Cards, unless you lock them; they are unavailable in preview mode.

![Metrics panel open beside the data grid with two metric cards: Avg of Shipped Weight 7,040.35 and Max of Quantity Sold 3983](https://mammoth.io/docs/images/20260421_090742_Metric_panel_with_metric_card1.webp)

## Create a metric from a column header

Use this for a quick Sum, Average, Standard Deviation, Min or Max of one column.

1. Hover a number column's header in the data grid.
2. Click the **Create Metric** icon that appears (number columns only).
3. In the **Create Metric** popup, check the **Metric name** (filled in, for example "Sum of quantity_on_hand", and editable).
4. Pick a **Function**: Sum, Average, Standard Deviation, Min or Max.
5. Set **Formatting**: currency, percentage, decimals and short form.
6. Click **Create Metric**. A "Metric added" message confirms it.

To add a title, subtitle, description, expression or conditions, click **More options** instead. The full metric editor opens with these settings filled in.

![Create Metric popover opened from the quantity column header, with Metric name, Function, Formatting, Short Form, More options and Create Metric](https://mammoth.io/docs/images/20261009_195053_CreateMetricPopover.webp)

## Open the Metrics panel

Two controls open the same panel:

- the **Metrics** icon in the action bar at the top of the data editor, next to the Highlights icon (it shows an active state while the panel is open);
- the rotated "Metrics" tab on the right edge of the View, which shows how many metrics the View has.

![View with the Metrics tab open, showing the Create a metric empty state and a New Metric button](https://mammoth.io/docs/images/20260605_092228_metrics-toolbar-icon-active1.webp)

With no metrics, the panel shows **Create a metric**, "Use this space to create some metrics from numerical data" and a **+ New Metric** button. Once it has cards, add more with the blue **+** button at the bottom of the panel.

In preview mode, the panel says metrics are unavailable and, when the View has metrics, offers **Exit Preview**.

## Create a metric with AI, SQL or a formula

Click **+ New Metric**. The modal opens in **SQL** mode, with an AI expression generator at the top. A switch changes between **SQL** and **Formula**. The book icon beside the title opens the documentation.

![New Metric modal with a prompt box and Generate button, SQL and Formula tabs, SQL Expression, Format with Display in short form, a Title field, Add More Details, and Cancel and Submit buttons](https://mammoth.io/docs/images/20261009_194758_NewMetricModal.webp)

### Describe the metric and let AI write the SQL

1. Type what you want in the box labelled "Describe what you want to generate", for example "Create a metric for the total quantity sold".
2. Click **Generate**, or press Enter. The AI writes the SQL expression.
3. Review it in the **SQL Expression** editor and adjust it if needed.
4. Optionally add a condition to limit which rows count. If your description includes a filter, Mammoth can move it into the condition.

### Build the expression yourself in Formula mode

Click **Formula** (next to **SQL**) and build the expression from functions and column references. You can add conditions here too. The editor shows "Looks good" when the syntax is valid.

| Mode | What you can use |
| --- | --- |
| Column header popup | Sum, Average, Standard Deviation, Min, Max |
| **Formula** | `COUNT()`, `SUM("Column")`, `AVG("Column")`, `MIN("Column")`, `MAX("Column")`, `STDDEV("Column")`, `INT(expression)`, `ABS(expression)`, combined with `+`, `-`, `*`, `/` and parentheses |
| **SQL** | Describe the metric in plain words and review the SQL, or edit the SQL directly |

Column names in formulas go in double quotes: `SUM("deal_value")`, not `SUM(deal_value)`.

**Formula examples:**

| Metric | Formula | Condition or format |
| --- | --- | --- |
| Net revenue | `SUM("gross_amount") - SUM("discount") - SUM("tax")` | |
| Performance against target | `(SUM("actual_quantity") / SUM("target_quantity")) * 100` | Format as % to show 87.5% |
| Completed sales | `SUM("amount")` | Condition: `status` is `Completed` |
| Open high-priority items | `COUNT()` | Conditions: `priority` is `High` and `status` is `Open` |

For a calculation that needs different conditions in one expression, such as a defect rate or a win rate, use SQL mode and describe it in plain words.

![New Metric modal in Formula mode with the formula SUM of sales divided by SUM of quantity marked Looks good, a preview card titled Sales per unit showing 123.19, and Format, Title and Add More Details](https://mammoth.io/docs/images/20261009_194914_NewMetricFormula.webp)

### Preview, label and submit

The right side of the modal previews the metric card with its current result, above a grid of the underlying rows.

| Label field | What it is |
| --- | --- |
| **Title** | The main label on the card (required). It starts as "Metric", or as "Sum of quantity_on_hand"-style text when you start from a column header |
| **Add More Details** | Reveals **Subtitle** (a short line under the value, such as "Q4 2024" or "West Region only") and **Description** (longer, smaller grey text under the value; hover the card to read it in full) |

Click **Submit**. It stays disabled, with a tooltip saying why, until the metric has a title and a valid expression, and while the SQL is still generating. If another metric already has the title, Mammoth adds a number (for example "Total sales 1").

## Format a metric as currency, a percentage or short form

The same format options appear in the column header popup and the full modal.

| Option | What it does |
| --- | --- |
| Numeric (default) | Plain number |
| Thousands separator (on by default) | Shows 1,234 instead of 1234 |
| % | Percentage |
| Currency | USD ($), EUR (€), GBP (£), JPY (¥) or INR (₹) |
| Decimal arrows (`< 0.00000 >`) | 0 to 5 decimal places (2 by default). Disabled while short form is on |
| **Display in short form** | 1,234,567 → 1.23M; 45,600 → 45.6K |

Use currency for revenue, percentage for rates and ratios, and short form for large counts.

![New Metric modal with the Format currency menu open, listing the euro, dollar, yen, pound and rupee symbols](https://mammoth.io/docs/images/20261009_194945_NewMetricCurrencyMenu.webp)

## Use a project parameter in a metric condition

A metric's condition can use a project or workspace parameter, so one value (a threshold, a date, a name) is set in one place. See [Parameters and snippets](https://mammoth.io/docs/learn/organise/parameters-and-snippets/).

1. In the New Metric modal, click **Add Condition**.
2. Pick the column and the operator.
3. For the value, choose **Parameter** (**Bind to a project parameter**) instead of **Value** (**A fixed value**).
4. Click **Select a parameter** and pick one. Only parameters whose type fits the column are offered; if none fit, the list shows "No parameters available".
5. Click **Apply Condition**, then **Submit**.

**Example:** `SUM("sales")` with the condition "discount greater than the parameter `max_discount`" adds up sales above the current discount threshold.

The expression itself has no **Insert Parameter** button, in **SQL** or **Formula** mode. To use a parameter inside a calculation, use a Math step in the pipeline. See [Calculate with formulas](https://mammoth.io/docs/learn/clean-and-shape/formulas/).

The metric uses the parameter's value when you save it. After you change the parameter, the metric picks up the new value the next time the View's pipeline runs. If the parameter is deleted, the metric keeps the last value as a fixed value.

## Copy, edit, duplicate, lock or delete a metric card

A card shows its title (with a lock icon when locked), the value, the Subtitle and the Description. A metric built from a plain-English description shows it in a row you can click to see the generated query. A metric with a condition shows it as a filter summary. If a metric can't be calculated, the card shows **Error**; hover it to see why.

Hover a card to see five action icons. They are disabled while the pipeline has an error.

| Icon | What it does |
| --- | --- |
| Copy to clipboard | Copies the title and current value at once, for example `Total sales: 5.2M` |
| Edit (pencil) | Opens the full editor: expression, Title, Subtitle, Description and formatting |
| Duplicate | Opens "Duplicate metric" with the original expression. The title gets a number, for example "Weight per unit sold 1". Edit or submit as is |
| Lock | Freezes the metric against explore filters. It keeps the filters active when you locked it. Click again to unlock |
| Delete (trash) | Removes the metric after you confirm |

Drag a card by its header to reorder the cards.

![Metrics panel with a Sales per unit card showing 123.19 and a hover toolbar with Copy, Edit, Duplicate, Lock and Delete icons](https://mammoth.io/docs/images/20261009_195010_MetricCardToolbar.webp)

## Watch metrics change as you filter

Metrics recalculate when you filter with Explore Cards. For example, before filtering: Total Revenue $5.2M, Average Deal $12,340, Order Count 421, Win Rate 67%. After double-clicking "West" on the Region card: $1.8M, $14,560, 124 and 72%.

![Animation comparing a View's metric values as a filter is applied to the Region card](https://mammoth.io/docs/images/20260421_163433_comparisonshowingmetrics.webp)

### Compare a segment with the total using lock

Lock a metric while no filters are on to keep its all-data value.

1. Lock "Total Revenue" at $5.2M.
2. Filter Region to West.
3. Create another Revenue metric and leave it unlocked. It shows $1.8M.
4. Compare: West is about 35% of total revenue.

The same works for any segment: a locked Total Sales of $3.2M beside an unlocked $1.1M filtered to East shows East is 34% of the business.

![Animation of a metric card being locked in the Metrics panel of a View with a Region card](https://mammoth.io/docs/images/20260421_164724_metric-lock1.webp)

![View filtered to Region East, with the Metrics panel showing a locked Sum of deal_value 3,202,500.00 and an unlocked metric](https://mammoth.io/docs/images/20260421_091837_Metric_with_lock_and_unlock_filter1.webp)

To follow a trend, filter month by month (Jan, Feb, Mar) and watch the values change.

### Example metric sets

- **Sales:** `SUM("deal_value")`, `AVG("deal_value")`, `COUNT()` with `status` is `Won`, and a win rate in SQL mode.
- **Manufacturing quality:** `COUNT()`, `COUNT()` with `defect_severity` is not `None`, a defect rate in SQL mode, and `AVG("yield_percentage")`.
- **Compliance:** `COUNT()`, `COUNT()` with `amount` > 10000, `SUM("amount")` with `amount` > 10000, and a compliance rate in SQL mode.

A good start for any dataset is 3–5 metrics: a total count, a key sum, a main average and one or two business ratios.

## Metrics compared with Explore Cards and View Insights

| | Metrics panel | Explore Cards | View Insights |
| --- | --- | --- | --- |
| Purpose | Single-value KPIs | Data distributions | AI-written observations |
| Made by | You, with calculations | You, for any column | The AI |
| Display | Large numbers with labels | Charts and ranked lists | Sentences |
| Kept | Saved with the View | Saved with the View | Saved until the View's data changes |

Use Explore Cards to find patterns, then create metrics to track the numbers behind them.

## Troubleshooting metrics

| Symptom | Cause | Fix |
| --- | --- | --- |
| Metric shows 0 or **Error** | Wrong column, Sum or Avg on a non-number column, unquoted column names, or nulls | Hover **Error** for the reason; check the column and type; write `SUM("column_name")` |
| Metric doesn't change when you filter | The metric is locked, or no filter is applied | Click the lock icon to unlock; check the filter badge beside **Explore**; refresh the View |
| **Submit** is disabled | No title, an invalid expression, or SQL still generating | Read the tooltip on **Submit** |
| Card icons are disabled | The pipeline has an error | Fix the failing step |
| Metrics panel says it is unavailable | You are in preview mode | Click **Exit Preview** |

## Related

- [Explore Cards](https://mammoth.io/docs/learn/explore/explore-cards/): the filters metrics follow.
- [View Insights](https://mammoth.io/docs/learn/explore/view-insights/): let AI summarize the View.
- [Parameters and snippets](https://mammoth.io/docs/learn/organise/parameters-and-snippets/): set a value once and use it in metric conditions.
- [Tables, KPI cards, insights and text](https://mammoth.io/docs/learn/dashboards/tables-kpis-text/): show numbers on a dashboard.
- [Schedules and triggers](https://mammoth.io/docs/learn/automate/schedules-and-triggers/): refresh data on a schedule so metrics stay current.
- [Use Mammoth on a phone](https://mammoth.io/docs/learn/explore/phone/): read metrics on a phone.

---
Source: https://mammoth.io/docs/learn/explore/metrics.md · Updated: 2026-11-08
