Skip to content

Computed Columns

Create and use computed columns to derive new metrics from your existing data.


Computed columns let you define derived values that don’t exist in your database but can be calculated from existing columns. This enables the agent to answer questions about metrics like revenue, profit margins, and other calculated fields.

Use computed columns when:

  • A common metric isn’t stored as a column (e.g. order total, profit margin)
  • Users ask questions using business terms that map to a calculation
  • You want the agent to use a specific formula consistently

Given an orders table with subtotal, discount, and tax columns but no total column:

total = subtotal - discount + tax

After adding this computed column, users can ask:

  • “What was our total revenue last month?”
  • “What’s the average order total for customers in New York?”
  • “Show me orders with a total over $500”

Given a products table with price and cost columns:

profit_margin = (price - cost) / price * 100

Now the agent can answer:

  • “What’s our average profit margin?”
  • “Which products have a margin below 20%?”
  1. Go to Configure in the Inconvo dashboard
  2. Select the table you want to add a computed column to
  3. Click Add Computed Column
  4. Enter the column name and expression
  5. Optionally set a unit (e.g. USD, %)
Terminal window
npx inconvo model computed \
--agent agt_123 \
--connection conn_456 \
--payload '{"table": "orders", "name": "total", "expression": "subtotal - discount + tax", "unit": "USD"}'

Computed columns work best alongside table prompts. For example, if you add a total computed column on the orders table, also add a table prompt:

Revenue is calculated as the sum of the total computed column. Average order value (AOV) is the average of total.

This ensures the agent uses the correct column when users ask about “revenue” or “AOV”.