Skip to main content
Formulas belong to saved Variables, and their calculated values appear in saved Table blocks. The Model the user sees is the source of truth for human and agent work alike, so an agent reads and writes formulas through the same tables a person uses. For how cfo.ai chooses a formula for each cell, see How formulas work; for the expression grammar and functions, see Formula syntax and Formula functions. Tool messages and field descriptions often call a saved formula a rule. These pages say formula, except when they quote the product.

Match the tool to the question

Two tools cover formula work. Each takes one action block named for the action. A question that existing values can answer stays read-only. A new calculated result needs a visible, saved formula and the user’s authorization to create it.

Start from the visible table

Read the relevant Table block once, reuse the row and column references it returns, and send related edits together. The server derives the Variable, the formula’s scope, its time range, and the write permissions from that visible target, so you never build them yourself. When the work has no table yet, read the existing Variables and Dimensions first, and reuse their returned references, such as Revenue#3f2, when you compose a formula. Write expressions with readable Variable names. Put backticks around a name that contains spaces, punctuation, an operator, or a reserved word, such as `Gross Profit`. Add a returned reference’s short suffix only when two names collide.

Respect the Scenario

Formulas are Scenario-scoped. Use the Scenario the user is working in, or the one they asked for, and pass it as scenario beside the action block. If a write could reasonably go to more than one Scenario, settle which one before you change the Model.

Keep the condition and the expression apart

A formula has two parts. The condition decides where it applies; the expression decides what it calculates. For a visible table edit, the server derives the condition from the target you choose:
  • a row’s own formula,
  • a child_defaults formula that the items beneath a row inherit, or
  • one cell.
Formula scope and formula ranges covers conditions and Actuals and Forecast ranges.

Verify the outcome

A formula that parses can still express the wrong business rule. After a material write, read the receipt’s warnings and the saved Table block, and compare representative periods and segments with what the user asked for. Validate and verify formula writes lists what a receipt reports and how to check the numbers.