Skip to main content

Formula Columns

Sometimes you need a new KPI or scoring criterion in your table. For that you can use a formula that calculates it from the data in other columns of your table.

This is useful when you want to compute a derived metric — for example from data in your CRM and product analytics — or transform an existing value to make it more useful for scoring.

To create a formula column, click the + sign at the top right of your table and select Formula.

Adding a formula column from the + menu

Enter the name of your column, and the formula editor opens:

Formula editor

Formula language​

A formula can use any standard SQL functions and expressions (see the full list of available functions). For example, a simple calculation of Customer Lifetime Value (CLTV):

average_monthly_revenue * customer_lifespan_months

This computes CLTV by multiplying the average monthly revenue per customer by the average customer lifespan in months.

Or a conditional expression, such as calculating Monthly Recurring Revenue (MRR) from subscription amounts:

subscription_amount /
CASE
WHEN subscription_term = 'Annual' THEN 12
WHEN subscription_term = 'Quarterly' THEN 3
ELSE 1
END

See more in the usage examples below.

Data type​

A formula is applied to each row of your table, and its result is converted to the data type you specify. In the MRR example above, the result is a number, so Number must be selected as the Data Type.

If the data type doesn't match the formula's output, you'll see an error. Try selecting a different data type in that case.

Usage examples​

Churn rate percentage​

(customers_lost / NULLIF(customers_at_start, 0)) * 100

This calculates the churn rate as a percentage by dividing the number of customers lost by the number of customers at the start of the period. NULLIF prevents division by zero.

Revenue growth rate percentage​

((revenue_current_period - revenue_previous_period) / NULLIF(revenue_previous_period, 0)) * 100

This computes the revenue growth rate between two periods as a percentage.

To round it to one decimal place, wrap it in the ROUND function:

ROUND(((revenue_current_period - revenue_previous_period) / NULLIF(revenue_previous_period, 0)) * 100, 1)

Sales cycle length in days​

DATE_DIFF(deal_closed_date, deal_created_date, DAY)

This calculates the length of the sales cycle for each deal as the number of days between when the deal was created and when it was closed.

Limitations​

Formulas currently have the following limitations:

  • A formula can't reference another formula column. To reuse one, copy its expression into the new formula column.
  • A formula can't reference other tables. To combine data from several tables, use enrichments.
  • A formula can't use aggregate functions. Formulas are evaluated row by row, so no aggregation is possible.