Forms, fields and formulas

How do I calculate VAT or GST percentages and totals on a purchase order form?

Store each rate in a Number field, compute the tax and line total with a formula, and round with roundup or ceil.

How-to

Short answer: Add a Number field for each tax rate, entered as a whole percentage such as 20. Compute the tax as Unit_Price * VAT_Percent / 100 and add it to the line total.

Why it happens

  • A rate typed as 20 means 20%, so divide by 100 before you multiply.
  • Currency fields have their own rules: you can add or subtract the same currency, and multiply or divide a currency by a number. See number and currency expressions.

How to fix it

Replace the field IDs below with your own.

  1. Add a Number field for each rate, for example VAT_Percent and GST_Percent.
  2. Tax amount: (Unit_Price * VAT_Percent) / 100
  3. Line total with both taxes: Quantity * (Unit_Price + (Unit_Price * VAT_Percent / 100) + (Unit_Price * GST_Percent / 100))
  4. For one tax: (Quantity * Unit_Price) + (Quantity * Unit_Price) * (Tax / 100)
  5. To convert currency, use Currency(Amount / Conversion_Rate, "GBP") when Amount is a Number field, or Amount.convert(Conversion_Rate, "EUR") when it's a Currency field. Make the rate field required so it's never empty.
  6. To round up to the nearest thousand, use Number_field.ceil(1000), or (Number_field / 1000).roundup() * 1000.

If an integration fills the total, for example when a purchase request creates a purchase order, don't also put a formula on that field in the target process. Map the value in the integration instead.

Tip

For a live exchange rate instead of a typed one, use a remote lookup field.

Related answers