# Math Fields: Computing Values

Source: https://ducted.app/help/kb/math-fields
Category: Transforms & Logic

A Math field computes a value from numbers you already have, so you can output columns your source doesn't actually store - a sale price, a margin, a unit price, a price with tax.

![A template field computing sale_price from a formula, Math mode on](https://ducted.app/kb/math.png)

## Writing a formula

Switch the field to **Math** mode and write an expression using `{{ column }}` tokens and the usual operators (`+`, `-`, `*`, `/`, and parentheses). For example, a price that is 20% off:

`{{ price }} - {{ price }} * {{ discountPercentage }} / 100`

## Numbers and currency, handled

- Currency symbols and thousands separators in the source (`€1.299,00`, `$1,299.00`) are parsed automatically.
- Both EU and US number formats are understood.
- The result is emitted as a clean number; add a **Format** transform if the platform wants a currency string like `1039.20 USD`.

## Common formulas

| Goal | Formula |
|---|---|
| Discount amount | `{{ msrp }} - {{ price }}` |
| Price with 20% tax | `{{ price }} * 1.2` |
| Unit price | `{{ price }} / {{ pack_size }}` |
| Margin percent | `( {{ price }} - {{ cost }} ) / {{ price }} * 100` |

## Empty or non-numeric inputs

If a token resolves to an empty or non-numeric value, the field outputs empty rather than a broken number - so a few bad rows never corrupt the whole feed. The Live Preview flags exactly which rows those are.
