Math

Calculate a new number from your columns. Type a formula, name the answer, apply.

What it does

Math is a formula box. You type an arithmetic formula. The app works it out for every row. The answer goes into the column you name.

There is no column picker in this panel. You name your columns inside the formula instead.

Write your first formula

The steps below add a line total to an invoice file.

  1. Type math in the Search transforms box, in the Pipeline panel.
  2. Select Math in the results.
  3. Click in the Expression box.
  4. Type "quantity" * "unit_price". Keep the double quotes around each column name.
  5. Go to Apply results into at the bottom.
  6. Type line_total in New Column Name.
  7. Click Apply.

How to write a formula

Two rules cover almost everything:

  • Put every column name in double quotes: "unit_price".
  • Write plain numbers without quotes: 1.18.

These symbols do the arithmetic:

  • + adds.
  • - subtracts.
  • * multiplies.
  • / divides.
  • ( and ) set the order of work, as in school maths.

Multiplication and division run before addition and subtraction. Add brackets when you need a different order.

Three formulas to copy

  • Line total: "quantity" * "unit_price"
  • Price with 18% tax: "unit_price" * 1.18
  • Margin as a share of revenue: ("revenue" - "cost") / "revenue"

Change the names in quotes to match your own columns.

Name the answer column

Apply results into controls where the answer lands.

  • New Column (Number) adds a number column at the end of the table. Type its name in New Column Name.
  • Existing Column shows a list of your columns. Pick one, and the answer overwrites it.

Math writes numbers only, so there are no type buttons in this panel.

Calculate for some rows only

Click Add Condition, build a test, then click Apply Condition. In a new column, rows that fail the test stay empty. In an existing column, they keep their old number.

If the formula does not run

  • Check the quotes. A missing double quote is the usual cause.
  • Check the spelling of each column name. It must match the grid exactly.
  • Check the column type. Run Convert Type first if a number arrived as text.
  • Use the Generate expression from intent helper to draft a formula in words. It needs an API key in Settings.

Generated SQL

A new column with no condition runs as:

SELECT *, "quantity" * "unit_price" AS "line_total" FROM data
Try Math with sample data →

Related Operations