Formulas: compute new columns in a chart
Before you start
A formula is a column you write yourself, computed from the columns your data already has. It works with every source you can connect. Free charts hold 1 formula; on the Starter plan a chart holds 10 formulas. Pricing lists every plan.
Add a formula
- Open a chart in the builder and find Formulas at the top of Shape.
- Press Add formula, give it a name and write the expression. Type
[for a list of your columns, or the first letters of a function for a list of functions. - The line under the box checks it as you type: “✓ Number · Row” when it works, or what is wrong and where (line and column). Save stays off until it works.
- Pick the formula by its name on the X axis, the Y axis, in Split by or in a filter, as you would a column.
Function reference in the same window lists every function with an example; press an example to put it in your formula. To rename a formula, edit it: the chart and the other formulas follow the new name.
Row and aggregate formulas
ChartOmodo reads what your formula does and treats it one of two ways. You do not choose.
- A row formula, such as
[Revenue] - [Cost], gives a value for each row. It works anywhere a column does: X, Y, Split by and filters. On Y it is summed, averaged or counted like any column. - An aggregate formula, such as
SUM([Revenue]) / SUM([Cost]), uses SUM, AVG, COUNT, COUNT_DISTINCT, MIN, MAX or MEDIAN. It is computed once per bar, point or slice, so it only goes on Y. The Aggregation menu disappears for it, and Cumulative and Percent of total switch off.
Write an expression
- Columns:
[Column name]. Write]]for a]inside the name.prop("Column name")works too. - Text:
"Won"or'Won'. Numbers:12,3.5,1e3, without thousands separators. AlsoTRUE,FALSEandNULL. - Dates:
DATE '2026-11-08'orDATETIME '2026-11-08 13:00:00'. - Operators, loosest first:
OR,AND,NOT, comparisons (= != <> < <= > >=,IS NULL,IN (…)),||to join text,+ -,* / %. - Function names and keywords ignore case. Comments:
/* … */, or--to the end of the line. A formula can span several lines. - A formula can use another formula on the same chart by its name, as long as no formula ends up using itself.
Empty values
- Arithmetic or a comparison with an empty value gives an empty value.
- An empty condition in IF, CASE or a filter counts as false.
- Dividing by zero gives an empty value instead of an error.
SAFE_DIVIDE(a, b)says the same thing out loud. - SUM, AVG and the other aggregations skip empty values.
COUNT([x])counts the rows where x is not empty; SUM over no values is empty. CONCATskips empty values, while||gives an empty value when either side is empty.- Numbers stored as text are read the way Sum reads them, so
1.234,5and1,234.5both work. A Notion date range counts as its start date; a multi-select reads as its options joined with commas.
Functions
Aggregation
| Function | What it does | Example |
|---|---|---|
SUM(x) | Adds up all values of x. Empty values are skipped, and the result is empty when there is nothing to add. | SUM([Revenue]) |
AVG(x) | Average of all values of x. Empty values are skipped. | AVG([Deal size]) |
COUNT(x) | Counts the rows where x is not empty. | COUNT([Deal]) |
COUNT_DISTINCT(x) | Counts the different values of x, exactly. Empty values are skipped. | COUNT_DISTINCT([Customer]) |
MIN(x) | Smallest value of x. Works on numbers, text and dates. Text that reads as numbers or dates is compared that way. | MIN([Close date]) |
MAX(x) | Largest value of x. Works on numbers, text and dates. Text that reads as numbers or dates is compared that way. | MAX([Amount]) |
MEDIAN(x) | Middle value of x. With an even count, the average of the two middle values. | MEDIAN([Deal size]) |
Number
| Function | What it does | Example |
|---|---|---|
ABS(x) | Absolute value of x. | ABS([Change]) |
ROUND(x, [digits]) | Rounds x to the given number of decimal places, 0 when left out. Halves round away from zero. Negative digits round to tens, hundreds and so on. | ROUND([Margin] * 100, 1) |
CEIL(x) | Rounds x up to the nearest whole number. | CEIL([Hours]) |
FLOOR(x) | Rounds x down to the nearest whole number. | FLOOR([Hours]) |
POWER(x, y) | x raised to the power y. | POWER([Growth], 2) |
SQRT(x) | Square root of x. Empty for negative numbers. | SQRT([Area]) |
LN(x) | Natural logarithm of x. Empty when x is zero or negative. | LN([Users]) |
LOG10(x) | Base 10 logarithm of x. Empty when x is zero or negative. | LOG10([Views]) |
SAFE_DIVIDE(a, b) | a divided by b, or empty when b is zero. | SAFE_DIVIDE([Profit], [Revenue]) |
NARY_MAX(a, b, ...) | Largest of the given numbers. Empty values are skipped. | NARY_MAX([Q1], [Q2], [Q3]) |
NARY_MIN(a, b, ...) | Smallest of the given numbers. Empty values are skipped. | NARY_MIN([Q1], [Q2], [Q3]) |
Text
| Function | What it does | Example |
|---|---|---|
CONCAT(a, b, ...) | Joins values into one text. Empty values are skipped. | CONCAT([First name], " ", [Last name]) |
LOWER(x) | x in lower case. | LOWER([Email]) |
UPPER(x) | x in upper case. | UPPER([Country code]) |
TRIM(x) | x without spaces at the start and the end. | TRIM([Name]) |
LENGTH(x) | Number of characters in x. | LENGTH([Title]) |
LEFT_TEXT(x, n) | The first n characters of x. | LEFT_TEXT([Code], 3) |
RIGHT_TEXT(x, n) | The last n characters of x. | RIGHT_TEXT([Phone], 4) |
SUBSTR(x, start, [length]) | Part of x from position start, where the first character is 1, up to length characters. | SUBSTR([SKU], 4, 2) |
REPLACE(x, find, with) | Replaces every occurrence of find in x. find is matched as plain text. | REPLACE([Phone], "-", "") |
CONTAINS_TEXT(x, s) | True when x contains s. Upper and lower case count as different. | CONTAINS_TEXT([Email], "@gmail") |
STARTS_WITH(x, s) | True when x starts with s. Upper and lower case count as different. | STARTS_WITH([SKU], "PRO") |
ENDS_WITH(x, s) | True when x ends with s. Upper and lower case count as different. | ENDS_WITH([Email], ".id") |
Date
| Function | What it does | Example |
|---|---|---|
TODAY() | Today's date in the chart's time zone. | DATE_DIFF(TODAY(), [Signup date]) |
DATE(year, month, day) | A date from its year, month and day. Empty when the parts are not a real date. | DATE(2026, 11, 8) |
DATE_DIFF(a, b) | Number of days from b to a, so a minus b. | DATE_DIFF([Closed], [Created]) |
DATETIME_DIFF(a, b, part) | How many part boundaries lie between b and a, for example how many month starts. Parts: SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR. | DATETIME_DIFF([Closed], [Created], MONTH) |
DATETIME_ADD(d, INTERVAL n part) | Adds n parts to d. Adding months keeps the day, or uses the last day of a shorter month. | DATETIME_ADD([Start], INTERVAL 30 DAY) |
DATETIME_SUB(d, INTERVAL n part) | Subtracts n parts from d. Months work as in DATETIME_ADD. | DATETIME_SUB(TODAY(), INTERVAL 1 MONTH) |
DATETIME_TRUNC(d, part) | Moves d back to the start of its part, for example the first day of its month. Weeks start on Monday. | DATETIME_TRUNC([Order date], MONTH) |
YEAR(d) | Year of d. | YEAR([Order date]) |
QUARTER(d) | Quarter of d, from 1 to 4. | QUARTER([Order date]) |
MONTH(d) | Month of d, from 1 to 12. | MONTH([Order date]) |
WEEK(d) | ISO week number of d, from 1 to 53. Weeks start on Monday. | WEEK([Order date]) |
WEEKDAY(d) | Day of the week of d, from 1 for Sunday to 7 for Saturday. | WEEKDAY([Order date]) |
DAY(d) | Day of the month of d, from 1 to 31. | DAY([Order date]) |
Logic
| Function | What it does | Example |
|---|---|---|
IF(cond, then, else) | Returns then when cond is true, otherwise else. An empty cond counts as false. | IF([Status] = "Won", [Amount], 0) |
CASE WHEN cond THEN result ... [ELSE result] END | Returns the result of the first WHEN that is true, otherwise ELSE. Also written CASE x WHEN value THEN result ... END. Empty when nothing matches and there is no ELSE. | CASE WHEN [Amount] > 1000 THEN "Large" ELSE "Small" END |
IFNULL(x, r) | x, or r when x is empty. | IFNULL([Discount], 0) |
COALESCE(a, b, ...) | The first value that is not empty. | COALESCE([Nickname], [Name]) |
NULLIF(x, v) | Empty when x equals v, otherwise x. Useful to avoid dividing by zero. | [Profit] / NULLIF([Revenue], 0) |
Conversion
| Function | What it does | Example |
|---|---|---|
CAST(x AS NUMBER | TEXT | DATETIME) | Turns x into a number, text or date. Empty when x can't be read that way. | CAST([Price text] AS NUMBER) |
Date parts for DATETIME_DIFF, DATETIME_ADD, DATETIME_SUB and DATETIME_TRUNC are words, not text: SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR.
Examples
Margin on every row. Put it on Y with Sum for the margin per month.
[Revenue] - [Cost]A ratio of totals, computed again for every bar or point.
SUM([Revenue]) / SUM([Cost])The amount of won deals only; lost ones count as 0.
CASE WHEN [Status] = "Won" THEN [Amount] ELSE 0 ENDDays from created to closed. Use it on X, or average it on Y.
DATETIME_DIFF([Closed], [Created], DAY)Unique customers per bucket.
COUNT_DISTINCT([Customer])The same margin, written the way Notion formulas name a column.
prop("Revenue") - prop("Cost")Differences from Notion formulas
- A Notion formula sees one page at a time. An aggregate formula here sees every row in a bar or point, which is how a ratio of totals works.
- Compare with one
=, not==. +adds numbers only. Join text withCONCAT()or||.prop("Name")and lower case names such asif()work, so most simple Notion formulas can be pasted in.- Your Notion formula columns still appear in the pickers as columns, and a formula here can read them like any other column.
If it does not work
The check says a column is unknown
“Unknown column [X].” means no column or formula on this chart has that name. Check the spelling; the message suggests a close name when there is one. If the column was renamed in your source, edit the formula to use the new name.
The check says it can’t mix aggregated and row values
“Can’t mix aggregated and row values. Wrap [Status] in an aggregation such as MAX(), or move SUM() outside.” In an aggregate formula every column has to sit inside SUM, AVG, COUNT or another aggregation.
The check says Circular reference
“Circular reference: Margin → Profit → Margin.” means the formulas use each other in a loop. Break the loop by writing one of them over columns only.
The check says the formula is nested too deeply
“Formula is nested too deeply.” Split it into two formulas and have one use the other.
Delete does nothing and says Used by
The formula is still on an axis, in Split by, in a filter or in another formula, and the message lists where. Take it out there first, then delete it.
Add formula opens an upgrade offer
The chart holds as many formulas as your plan allows. Remove one, or upgrade for more.
A series is empty after a change in your source
A column the formula reads was renamed or removed, so it reads as empty and the chart draws nothing for it. Open the chart in the builder: the formula shows the error in red under Formulas.
Questions
Does a formula change my data?
No. ChartOmodo computes it each time it draws the chart. Your Notion database, file or table stays as it is.
Can I use one formula on several charts?
Not yet. A formula belongs to the chart it was written in. Duplicate the chart to start from the same formulas.
Why does summing a ratio give a strange number?
A per row ratio summed per bucket adds up each row's ratio. Write the ratio of totals instead: SUM([a]) / SUM([b]).