Skip to main content
Help & Documentation

Write and check a calculation

Describe a calculation in plain words, refine it with AI, and check it row by row with a live preview and Explain calc before you save.

13 min readUpdated November 22, 2026

The calculation editor is where every calculated field starts. Write a formula yourself, or let AI write one from a sentence, and see exactly what it does to your real rows before it touches a chart.

The Create calculated field dialog with the field name Shipping Status, the formula IF(DATEDIFF("day", Order Date, Ship Date) > 4, "Late", "On time") marked Valid, a preview of Order Date, Ship Date and Shipping Status for 8 sample rows, the summary Text · On time (33), Late (17), and Explain calc working out the Jan 4 row to On time, with the Templates tab open on the right

When to use it

  • A metric your data doesn't have. A finance lead types "profit margin as a % of sales" and gets a working formula without knowing the function names.
  • Checking an inherited formula. An analyst opens a teammate's field, clicks a row, and reads Explain calc to see how it got that number.
  • Tightening a first draft. An ops manager has days to ship, then asks AI to "count business days only" and compares the before and after columns.
  • Catching a wrong answer early. A sales manager spots that a margin repeats 18.4% on every row and learns it's an aggregate before it lands on a chart.

If you've ever saved a formula, built a chart and only then found it was wrong, check it here first.

Getting started

  1. Open an analysis and go to the Fields tab.
  2. Scroll to the Calculated group and click New calculated field. You can also press ⌘K and run Create calculated field from anywhere in an analysis.
  3. Give it a Field name, write the Formula, and click Create field (or press ⌘↵).

From chat:

Create a calculated field for days between order date and ship date

Generate with AI

At the top of the dialog, Generate with AI writes a new formula from a description. Type what you want, like "number of days from order date to ship date", and click Generate formula.

Generate with AI with the prompt "profit margin as a % of sales, blank when sales is zero", the generated formula IF(SUM(Sales) = 0, NULL, SUM(Profit) / SUM(Sales)) marked Valid, a one-line explanation under it, and the field named Profit Margin

Golden fills in the formula, a one-line explanation of what it does, and the preview. The formula is yours to edit like any other.

Tip: Be specific about edge cases. "Blank when sales is zero" gets you a guard against dividing by zero; "profit margin" alone may not.

Refine with AI

Once there's a formula, a Refine with AI box appears under the operator buttons. Ask for a change, like "make it a percent" or "count business days only", and click Refine.

Refine with AI after the prompt "count business days only": the old DATEDIFF formula struck through above the new BUSINESSDAYS(Order Date, Ship Date), a suggested name "Shipping Business Days" with Use this name, a preview with a Before column next to the new Days to Ship column, and the bar "AI changed the formula. Saving keeps the change." with Discard and Keep change

You see the old formula struck through, a Before column next to the new result, and sometimes a better name with Use this name. Click Keep change to accept it or Discard to go back.

Write it yourself

Refer to fields in square brackets, like [Profit] / [Sales]. In the Formula box, type a function name, [ or @ to get suggestions. The operator buttons under it insert +, -, ×, ÷, parentheses, comparisons (=, ≠, >, <, ≥, ≤) and AND, OR, NOT.

Golden checks the formula as you type and shows Valid when it works. If it isn't, the message tells you what's wrong, such as Unbalanced parentheses.

The panel on the right has Functions, Fields and Templates tabs, with one search box for all three. See Calculation function reference and Start from a calculation template.

Read the preview

Under the formula, the preview runs it on 50 sample rows from your data. The summary line tells you the result type, how many rows came back empty, and the range (for numbers) or the most common values (for text), like On time (33), Late (17).

The table shows the fields your formula uses next to the result. Use the arrows to page through the sample.

If your formula adds rows up (with SUM, AVG and the like), the preview says so: it produces one value per group, so every sample row shows the same number. On a chart, it's worked out for each bar or point.

A preview where every row shows 18.4% for Profit Margin, under the note "This formula aggregates across rows, so it produces one value per group rather than one per row. The preview computes it over the sample; on a chart it is computed per whatever the chart groups by."

Explain calc

Click any row in the preview, then Explain calc. Golden rewrites the formula with that row's real values in place of each field and shows the result at the end.

Explain calc for the formula IF(DATEDIFF("day", Order Date, Ship Date) > 4, "Late", "On time"), with Order Date filled in as Jan 4, 2022, Ship Date as Jan 8, 2022, and the result On time

It's the fastest way to see why a row landed in the "wrong" bucket: you can read the dates, the comparison and the answer in one line.

Empty inputs

Empty inputs decides what happens when a field in the formula is blank:

OptionWhat it does
Keep emptyThe result is blank too.
Use zeroBlank numbers count as 0 in the calculation.

It updates the zero-fill guards in the formula. Any blank handling you wrote yourself, like COALESCE, stays as written.

Display format

Display format sets how the result looks everywhere it's used. Field type follows the formula; choose Geographic (and a role like State, Zip code or Latitude) to put a text result on a map.

The Display format section with the Format menu open: Standard, Currency, Percentage, Duration and Scientific, next to Decimals set to 2 and empty Prefix and Suffix boxes
SettingWhat it does
FormatStandard, Currency, Percentage, Duration or Scientific.
DecimalsHow many decimal places to show.
PrefixText before the number, like ~.
SuffixText after the number, like ms.

Duration shows a number as time, in Seconds, Minutes, Hours, Days, Weeks, Months or Years. The line above the settings shows an example, like Example: 123,456.7%. Text fields have no formatting options.

Do it from chat

Ask the analyst for the field in plain words. It writes the formula, names the field and adds it to your Fields list.

Create a calculated field for profit margin as a percentage
Add a field that labels orders Late when they took more than 4 days to ship
Change Days to Ship to count business days only

FAQ

Does Generate with AI see my data? It sees your field names and types, and writes a formula from them. The preview then runs that formula on your sample rows so you can check it.

Why is every row in the preview the same? Your formula adds rows up. It gives one value per group, so it's worked out for each bar or point on a chart.

Can I edit a field later? Yes. Right-click it in the Fields list and choose Edit Formula. The same dialog opens with the preview and Explain calc.

Is my original data changed? No. A calculated field is worked out from your fields, and the original columns stay as they are.