Formula field reference

Access Baserow’s complete formula function library and learn common formula patterns for calculations, text manipulation, date operations, and logical conditions.

This reference guide helps you build powerful formulas in Baserow. For a general introduction to formulas, see the Formula field overview.

Using the formula reference

Baserow formulas support multiple field types, including Duration fields and Multiple select fields. You can perform mathematical operations, text manipulation, date calculations, and logical comparisons across your data.

Finding functions

The formula editor in Baserow includes built-in autocomplete and function suggestions. As you type, relevant functions appear with syntax hints and examples.

To explore available functions:

  1. Create or edit a Formula field
  2. Start typing in the formula editor
  3. Browse suggested functions with descriptions
  4. Click on a function to see syntax and examples

Working with complex field types

Multiple select fields

Formulas work with Multiple select fields to check which options are selected and perform operations on that data.

Multiple select support in formula fields

When working with Link-to-table fields, use lookup() to access fields from linked records, then apply aggregation functions like sum(), count(), or join().

Lookup and Rollup fields

Lookup fields and Rollup fields return arrays. Convert them to single values using aggregation functions before using them in conditions or comparisons.

Common formula patterns

These examples demonstrate frequently used formula patterns. Replace field names with your own table fields.

Calculations and math

Calculate total price:

field('Quantity') * field('Unit Price')

Apply percentage discount:

field('Price') * (1 - field('Discount Percent') / 100)

Round to 2 decimal places:

round(field('Amount'), 2)

Find the greater value:

greatest(field('Value A'), field('Value B'))

Text operations

Combine first and last name:

concat(field('First Name'), ' ', field('Last Name'))

Convert to uppercase:

upper(field('Product Code'))

Extract first 10 characters:

left(field('Description'), 10)

Check if text contains a word:

contains(field('Notes'), 'urgent')

Date and time

Calculate days between dates:

date_diff('day', field('Start Date'), field('End Date'))

Format date as text:

datetime_format(field('Created'), 'YYYY-MM-DD')

Check if date is in the past:

field('Due Date') < today()

Get the year from a date:

year(field('Date Field'))

Conditional logic

Display different text based on status:

if(field('Status') = 'Complete', '✓ Done', '⧗ Pending')

Use default value when field is empty:

when_empty(field('Notes'), 'No notes added')

Combine multiple conditions:

if(and(field('Quantity') > 0, field('Price') > 100), 'In Stock - Premium', 'Standard')

Working with linked tables

Sum values from linked records:

sum(lookup('Orders', 'Total'))

Count linked items:

count(field('Related Items'))

Join text from multiple records:

join(lookup('Projects', 'Name'), ', ')

Filter and sum:

sum(filter(lookup('Items', 'Price'), lookup('Items', 'Status') = 'Active'))

Creating interactive buttons

Create a clickable button:

button('https://example.com/' + field('ID'), 'View Details')

Link to email address:

link('mailto:' + field('Email'))

Formula buttons in Baserow

Frequently asked questions

How do I reference other fields in formulas?

Use the field() function with the exact field name in single quotes: field('Field Name'). Field names are case-sensitive and must match exactly.

Lookup and Link-to-table fields contain arrays (multiple values), not single values. Most functions expect single values. Use aggregation functions like sum(), join(), count(), or avg() to convert arrays into single values.

Example problem:

isblank(field('Organization'))  // Won't work if Organization is a link field

Solution:

isblank(join(field('Organization'), ''))  // Converts array to text first

Can I use formulas with Duration fields?

Yes. Duration fields support mathematical operations directly. You can add, subtract, multiply, and divide duration values just like numbers. Learn more about Duration fields.

How do I check if a date is a specific day of the week?

Use datetime_format() with the ‘D’ format code, where Sunday = 1, Monday = 2, etc:

datetime_format(field('Date Field'), 'D') = '1'  // Returns true if Sunday

For more date formatting options, see the PostgreSQL formatting documentation.

Do the today() and now() functions update automatically?

Yes. Both functions update every 10 minutes. Use today() for the current date only, and now() when you need both date and time.

How do I handle empty or null values in formulas?

Use when_empty() to provide fallback values, or isblank() to check if a field is empty:

when_empty(field('Optional Field'), 'Default Value')
if(isblank(field('Name')), 'No name provided', field('Name'))

Can I use regular expressions in formulas?

Yes. Use regex_replace() to find and replace text patterns:

regex_replace(field('Phone'), '[^0-9]', '')  // Removes non-numeric characters

Documentation

Technical guides


Still need help? If you’re looking for something else, please feel free to make recommendations or ask us questions; we’re ready to assist you.