Skip to content
Learn › Explore your data: open the docs menu

Create metrics and KPIs in the Mammoth Metrics panel

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.

View with the Metrics panel open on the right, showing the locked Total revenue 15,375,964.93 and Average price 289.62 beside the Explore cards and grid

Create a metric from a column header

  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.

For a title, subtitle, description, expression or conditions, click More options instead: the full 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

Open the Metrics panel

Click the Metrics icon in the action bar, next to the Highlights icon (it shows an active state while the panel is open), or the rotated "Metrics" tab on the right edge of the View, which shows how many metrics the View has.

Metrics panel open on supplier_invoices.csv with no metrics yet: Create a metric, Use this space to create some metrics from numerical data, and New Metric, with the Metrics toolbar icon highlighted

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

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, with conditions if needed. The editor shows "Looks good" when the syntax is valid.

ModeWhat you can use
Column header popupSum, Average, Standard Deviation, Min, Max
FormulaCOUNT(), SUM("Column"), AVG("Column"), MIN("Column"), MAX("Column"), STDDEV("Column"), INT(expression), ABS(expression), combined with +, -, *, / and parentheses
SQLDescribe 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:

MetricFormulaCondition or format
Net revenueSUM("gross_amount") - SUM("discount") - SUM("tax")
Performance against target(SUM("actual_quantity") / SUM("target_quantity")) * 100Format as % to show 87.5%
Completed salesSUM("amount")Condition: status is Completed
Open high-priority itemsCOUNT()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

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 fieldWhat it is
TitleThe 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 DetailsReveals 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.

OptionWhat it does
Numeric (default)Plain number
Thousands separator (on by default)Shows 1,234 instead of 1234
%Percentage
CurrencyUSD ($), 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 form1,234,567 → 1.23M; 45,600 → 45.6K

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.

  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.

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, lock and compare metric cards

Hover a card to copy, edit, duplicate, lock or delete it. A locked metric ignores explore filters, so you can compare a segment with the total. See Lock, edit and compare metrics.

Troubleshooting metrics

SymptomCauseFix
Metric shows 0 or ErrorWrong column, Sum or Avg on a non-number column, unquoted column names, or nullsHover Error for the reason; check the column and type; write SUM("column_name")
Submit is disabledNo title, an invalid expression, or SQL still generatingRead the tooltip on Submit
Metrics panel says it is unavailableYou are in preview modeClick Exit Preview
Was this page helpful?

Something wrong? support@mammoth.io