Skip to content

Formulas

A Formula property works out a value for each row from the row’s other properties. It might add two numbers, count days until a deadline, or show an emoji when a box is checked.

Lyra uses the same formula syntax as Notion, so formulas you import from Notion keep working.

prop("Estimate") * 2
if(prop("Done"), "✅", "")
dateBetween(prop("Due"), now(), "days")
  1. Add a property and pick Formula, or click a formula’s header and pick Edit property.
  2. Type the formula in the Formula box. Buttons under it insert a property (prop("Name")) or a common function.
  3. Lyra checks the formula as you type. Under the box you’ll see what it returns, such as Returns number, or what’s wrong with it.
  4. Click Save formula, or press Cmd+Enter (Ctrl+Enter on Windows and Linux).

You can only save a formula that checks out.

Lyra works out formulas inside the database, so you can filter and sort on a formula like on any other property.

prop("Name") reads the row’s value for a property, using the property’s exact name in quotes. When you rename a property, Lyra updates the formulas that use it.

Write For
42, 3.5, .5, 1e3 Numbers
"text" or 'text' Text. Use \" for a quote inside, \n for a new line and \t for a tab
true, false True or false

From the first to bind to the last:

Operator What it does
-x, not x, !x Negative number, opposite of true or false
^ Power: 2 ^ 3 is 8
*, /, % Multiply, divide, remainder
+, - Add, subtract. + joins text when either side is text: "Total: " + 5 is Total: 5
>, >=, <, <= Compare numbers, text or dates
== (or =), != Equal, not equal
and (or &&) True when both sides are true
or (or ||) True when either side is true
condition ? a : b a when the condition is true, otherwise b. The same as if(condition, a, b)

Use parentheses to change the order: (prop("Price") + prop("Tax")) * prop("Quantity").

Dividing by zero, or taking a remainder of zero, gives an empty value rather than an error.

Call a function with its arguments in parentheses: upper(prop("Name")). You can also put the first argument before a dot: prop("Name").upper() means the same thing. The dot form reads well when you chain several:

prop("Tags").filter(current != "Archived").join(", ")

Every formula returns one of four types. The editor shows which one under the box.

Type Shows as Filters as
text Text Text
number A number Number
boolean A checkbox Checkbox
date A date Date
Property type In a formula
Title, Text, URL, Email, Phone Text
Number, ID Number
Checkbox Boolean. An unchecked box is false
Date, Created time, Last edited time Date. For a date range, this is the start. Use dateEnd() for the end
Select, Status The option’s name as text
Multi-select The options’ names, joined with commas. In list functions, a list of names
Person The people’s names, joined with commas. In list functions, a list of names
Created by, Last edited by The person’s name as text
Files & media The file names, joined with commas
Relation The linked rows’ titles, joined with commas. In list functions, a list of rows
Formula That formula’s result
Rollup That rollup’s result
  • + with text on either side turns the other side into text. Numbers keep their digits, booleans become true or false, and dates look like Jan 5, 2026.
  • ==, !=, > and the other comparisons need the same type on both sides. Use toText() or toNumber() to convert first.
  • When if() or ifs() can return values of different types, the result is text.
Function What it returns
if(condition, a, b) a when the condition is true, otherwise b
ifs(c1, a, c2, b, …, otherwise) The value after the first true condition, or the last value when none is true
and(a, b), or(a, b), not(a) The same as and, or and not
equal(a, b), unequal(a, b) The same as == and !=
larger(a, b), largerEq(a, b), smaller(a, b), smallerEq(a, b) The same as >, >=, < and <=
empty(x) True when x has no value. Empty text counts as empty, and so does false. For a list, true when it has no items
Function What it returns
concat(a, b, …) All the values joined into one text
length(text) The number of characters. For a list, the number of items
lower(text), upper(text) The text in lowercase or uppercase
trim(text) The text without spaces at the start and end
contains(text, search) True when the text contains search. Upper and lowercase count as different
startsWith(text, search), endsWith(text, search) True when the text starts or ends with search
test(text, pattern) True when the text matches a regular expression
replace(text, pattern, replacement) The text with the first match of a regular expression replaced
replaceAll(text, pattern, replacement) The text with every match replaced
slice(text, start, end) Part of the text. Positions count from 0, and end is left out. Leave end off to go to the end. substring() is the same
repeat(text, times) The text repeated, up to 1,000 times
split(text, separator) A list of the parts between each separator
format(x), toText(x) Any value as text

Regular expressions can be up to 500 characters and can’t refer back to earlier matches (\1). A pattern Lyra can’t use gives an empty value.

Function What it returns
add(a, b), subtract(a, b), multiply(a, b), divide(a, b) The same as +, -, * and /
mod(a, b) The remainder of a divided by b
pow(a, b) a to the power of b
abs(n) The number without its sign
round(n), round(n, places) The number rounded, to whole numbers or to that many decimal places
ceil(n), floor(n) The number rounded up or down to a whole number
sqrt(n) The square root
exp(n), ln(n), log10(n), log2(n) e to the power of n, and logarithms
sign(n) 1, 0 or -1
min(a, b, …), max(a, b, …) The smallest or largest number. They also take lists of numbers or dates
sum(…), mean(…), median(…) The total, average or middle value of numbers and lists of numbers
toNumber(x) Text that’s a plain number becomes that number, and other text gives an empty value. true is 1 and false is 0. A date becomes milliseconds since January 1, 1970
Function What it returns
now() The current date and time
today() The start of today
dateAdd(date, amount, "unit") The date moved forward by amount units
dateSubtract(date, amount, "unit") The date moved back by amount units
dateBetween(later, earlier, "unit") Whole units from earlier to later. Negative when later comes first
formatDate(date, "format") The date as text. See Date formats
year(date) The year, like 2026
month(date) The month, from 1 for January to 12
date(date) The day of the month, from 1 to 31
day(date) The day of the week, from 0 for Sunday to 6 for Saturday
week(date) The ISO week of the year
hour(date), minute(date) The hour from 0 to 23, and the minute
dateStart(date) The start of a date range
dateEnd(date) The end of a date range, or the date itself when it isn’t a range
timestamp(date) Milliseconds since January 1, 1970
fromTimestamp(n) The date n milliseconds after January 1, 1970
parseDate(text) A date from text that starts with YYYY-MM-DD, like 2026-06-05. Other text gives an empty value

Units are "years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds" and "milliseconds". The singular works too ("day"), and upper or lowercase doesn’t matter. Write the unit as text in quotes, not as a property.

formatDate() replaces these letters with parts of the date. Other letters, spaces and punctuation stay as they are.

Letters Example
YYYY, YY 2026, 26
MMMM, MMM, MM, M January, Jan, 01, 1
DD, D, Do 05, 5, 5th
DDDD Day of the year, 005
dddd, ddd Monday, Mon
HH, H Hour from 0 to 23: 09, 9
hh, h Hour from 1 to 12: 09, 9
mm, ss Minutes and seconds: 07, 30
A, a AM or PM, am or pm
formatDate(prop("Due"), "dddd, MMMM Do")

Relations, multi-selects, people and split() give lists. These functions work on lists:

Function What it returns
length(list), empty(list) The number of items, or whether there are none
map(list, value) A list of value worked out for each item
filter(list, condition) The items where the condition is true
find(list, condition) The first item where the condition is true
findIndex(list, condition) The position of that item, counting from 0, or -1
some(list, condition), every(list, condition) Whether the condition is true for any item, or for all of them
includes(list, value) Whether the list has that value
first(list), last(list), at(list, position) One item. at() counts from 0
slice(list, start, end) Part of the list, counting from 0
sort(list), reverse(list), unique(list) The list in order, backwards, or without repeats
flat(list) The same list. Lists in Lyra are already flat
join(list, separator) The items as one text, with separator between them
sum(list), mean(list), median(list), min(list), max(list) Totals and other summaries of numbers

Inside map(), filter(), find(), findIndex(), some() and every(), the word current means the item being looked at. When the list comes from a relation, current is a row, and current.prop("Name") reads that row’s property.

prop("Tasks").filter(current.prop("Status") == "Done").length()

.prop() also works on a row picked with first(), last(), at() or find():

prop("Tasks").find(current.prop("Priority") == "High").prop("Owner")

A list used where a single value is expected, such as the formula’s result, shows as its items joined with commas.

Function What it returns
id() The row’s id as text
Formula What it shows
prop("Price") * prop("Quantity") The total for a line
if(prop("Done"), "✅", "⏳") An emoji for done or not done
dateBetween(prop("Due"), today(), "days") Days left until the due date
prop("Due") < now() and not prop("Done") A checkbox that’s checked when the row is overdue
ifs(prop("Score") >= 90, "A", prop("Score") >= 75, "B", "C") A grade from a score
prop("First name") + " " + prop("Last name") A full name
round(prop("Done tasks") / prop("All tasks") * 100) + "%" Progress as text, like 67%
prop("Tasks").filter(current.prop("Status") != "Done").length() How many linked tasks are still open
formatDate(prop("Created time"), "YYYY-MM-DD") The creation date as 2026-06-05
prop("Email").split("@").last() The domain of an email address

The editor shows what’s wrong while you type. The most common messages:

Message What to do
There is no property called "Name" Check the spelling, including upper and lowercase, or pick the property from the buttons under the box
Lyra doesn't support the function name() yet Use another function from this page. Notion functions such as let(), style() and link() aren’t supported
name() takes 2 values, not 3 Give the function the number of arguments it expects
The condition of if() needs a boolean, but got a text Compare the value to something, like prop("Status") == "Done"
Can't compare a text with a number Convert one side with toText() or toNumber()
'-' works on numbers, but got a text and a number Convert the text with toNumber()
dateAdd() needs the unit in quotes, like "days" Write the unit as text
"fortnights" is not a unit dateAdd() knows Use one of the units listed above
prop() takes one property name in quotes Write prop("Name") with the name in quotes
'name' needs parentheses, like name() Add () after a function name
A text value is missing its closing quote Close the quote
The formula ends too early Finish the formula, for example by closing a parenthesis
current only works inside map(), filter() and the other list functions Use current only inside a list function
name() works on a list, such as a relation Give the function a relation, multi-select, person or split()
Formula 'Name' refers to itself A formula can’t use its own value, directly or through another formula

If a formula stops working after you save it, for example because a property it uses was deleted, its cells are empty until you fix it.

  • A formula can be up to 5,000 characters long.
  • Formulas and rollups that use other formulas and rollups can go 4 levels deep. Past that you’ll see Formulas are nested too deeply.
  • A formula that would take too much work to run shows This formula is too large. Split it into smaller formulas. Move parts of it into formula properties of their own.