Skip to main content
Calculations let you combine fields, operators, and functions to derive values from your data. Use them in automations, layouts, and data processing when you need totals, text formatting, date math, or conditional logic.
When a formula isn’t behaving as expected, ask the AI Docs Assistant to help troubleshoot your calculation or Execute Script action. Describe your input, the result you want, and where the value is used (for example, an Update Record field or a Repeat for Each loop), and it will compose or debug the expression from documented functions.

Where to use calculations

Calculations can be configured in several places in Elementum:
  • Automations — Use the Run Calculation action to evaluate expressions from triggers or previous actions (see Automation actions reference).
  • Element layouts — Add formulas to derive values on records.
  • Calculated columns in tables — For example, Total = Quantity × Price (see Tables).
  • Reports — Add formulas to Excel reports (see Reports).

Quick Start

Get started with basic calculations

Function Reference

Complete list of all available functions

Business Examples

Real-world calculation scenarios

Troubleshooting

Common issues and solutions

Quick Start

New to calculations? Start with these patterns for totals, text, dates, and conditional logic.

Most Used Functions

Common date recipes

The most-asked date questions, with the exact syntax to use.

Get today’s date

Elementum does not have a TODAY() function. Use NOW() for the current date and time, and wrap it in DATE() if you need just the date portion:

Get the current date and time

NOW() returns the current timestamp. It takes no arguments:
Use it inside other functions to derive values against the current moment:

Add days to a date

Use DATEADD(unit, value, date) with an unquoted unit token like DAY or MONTH:

Subtract days from a date

Pass a negative value to DATEADD:
DATEADD handles month and year rollovers automatically — adding days across the end of a month advances into the next month as expected.

Business Examples

Calculate Monthly Sales Performance

Function Reference

Functions are organized by category. Use the search function (Ctrl/Cmd + K) to quickly find specific functions.

Logical Functions

Tests multiple conditions and returns TRUE only if all are TRUE.Syntax: AND(condition1, condition2, ...)Business Example:
Arguments:
  • condition1, condition2, ...: Logical expressions that evaluate to TRUE/FALSE
If any condition is blank, the result will be blank.
Tests multiple conditions and returns TRUE if any are TRUE.Syntax: OR(condition1, condition2, ...)Business Example:
Arguments:
  • condition1, condition2, ...: Logical expressions that evaluate to TRUE/FALSE
If any condition is blank, the result will be blank.
Returns different values based on a condition.Syntax: IF(condition, value_if_true, value_if_false)Business Example:
Arguments:
  • condition: Logical expression
  • value_if_true: Value returned when condition is TRUE
  • value_if_false: Value returned when condition is FALSE
For more than two outcomes, use IFS instead of nesting multiple IF statements—it’s flatter and easier to read.
Evaluates multiple conditions in order and returns the value corresponding to the first condition that is TRUE.Syntax: IFS(condition1, value1, condition2, value2, ...)Business Example:
Arguments:
  • condition1, condition2, ...: Logical expressions evaluated in order
  • value1, value2, ...: Value returned for the corresponding condition when it is the first to evaluate to TRUE
When no condition is TRUE, IFS returns blank. Include a final TRUE() condition as a catch-all to guarantee a value is always returned.

Numeric Functions

Returns the numerical average of values in a related field.Syntax: AVERAGE(related_field)Business Example:
Arguments:
  • related_field: Field from related records to average
Blank values are automatically excluded from the calculation.
Counts non-null values in a related field that meet a specified condition.Syntax: COUNTIF(related_field, criterion)Business Example:
Arguments:
  • related_field: Field from related records to count
  • criterion: Condition to meet (supports comparison operators)
Alternative syntax: SUM(IF(RELATED."Field" = 'Paid', 1, 0))
Counts the number of unique values in a related field.Syntax: COUNTUNIQUE(related_field)Business Example:
Arguments:
  • related_field: Field from related records to count unique values
Null values are excluded from the count.
Returns the maximum value from a given set of values.Syntax: MAX(value1, value2, ...)Business Example:
Arguments:
  • value1, value2, ...: Values to compare
Blank values are ignored. For aggregate calculations, use MAX_AGGREGATE.
Returns the minimum value from a given set of values.Syntax: MIN(value1, value2, ...)Business Example:
Arguments:
  • value1, value2, ...: Values to compare
Blank values are ignored. For aggregate calculations, use MIN_AGGREGATE.
Rounds a number to a specified number of decimal places.Syntax: ROUND(number, [decimal_places])Business Example:
Arguments:
  • number: Number to round
  • decimal_places: [OPTIONAL] Number of decimal places (default: 0)
Negative decimal_places rounds to left of decimal point (e.g., -1 rounds to tens).
Calculates the standard deviation of a related field.Syntax: STDEV(related_field)Business Example:
Arguments:
  • related_field: Field from related records to calculate standard deviation
Standard deviation measures how spread out values are from the average.
Returns the sum of values in a field that meet a specified condition.Syntax: SUMIF(related_field, criterion)Business Example:
Arguments:
  • related_field: Field from related records to sum
  • criterion: Condition values must meet
Use operators like greater than, less than, greater than or equal to, less than or equal to, and equal to in your criteria.

Date and Time Functions

Returns the current date and time.Syntax: NOW()Business Example:
This function takes no arguments and always returns the current moment. There is no separate TODAY() function — use NOW() and, if you need date-only, wrap it in DATE(YEAR(NOW()), MONTH(NOW()), DAY(NOW())).
Adds a value in a given unit to a date or datetime. Pass a negative value to subtract.Syntax: DATEADD(unit, value, date)Business Example:
Arguments:
  • unit: Date/time unit token — for example, DAY or MONTH. Passed unquoted.
  • value: Number of units to add. Use a negative number to subtract.
  • date: Starting date or datetime
DATEADD handles month and year boundaries automatically — adding days across the end of a month or year rolls forward as expected. This is the recommended way to shift a date by a fixed amount.
Returns a date value based on provided year, month, and day.Syntax: DATE(year, month, day)Business Example:
Arguments:
  • year: Four-digit year
  • month: Month (1-12)
  • day: Day of month (1-31)
Values exceeding normal ranges automatically adjust (e.g., month 13 becomes January of next year).
To shift a date by a fixed amount (add or subtract days, months, and so on), use DATEADD rather than building a new DATE with adjusted components.
There is no direct “datetime to date” conversion option in calculations or in the Update Record Fields automation action. To populate a Date field from a DateTime field, wrap the datetime value in DATE(YEAR(...), MONTH(...), DAY(...)) as shown above.
Returns a datetime value in the company’s timezone.Syntax: DATETIME(year, month, day, hour, minute, second)Business Example:
Arguments:
  • year: Four-digit year
  • month: Month (1-12)
  • day: Day of month (1-31)
  • hour: Hour (0-23)
  • minute: Minute (0-59)
  • second: Second (0-59)
Time is set in your company’s timezone.
Calculates the difference between two dates in specified units.Syntax: DATEDIF(start_date, end_date, unit)Business Example:
Arguments:
  • start_date: Beginning date
  • end_date: End date
  • unit: ‘Y’ for years, ‘M’ for months, ‘D’ for days
Returns negative values if start_date is after end_date.
Truncates a datetime to a specified unit.Syntax: DATETIME_TRUNC(datetime, unit)Business Example:
Arguments:
  • datetime: Datetime to truncate
  • unit: YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND
Useful for grouping data by time periods.
Converts text date value into a DATE object.Syntax: DATEVALUE(text_date)Business Example:
Arguments:
  • text_date: Text representation of a date
Returns null if the text cannot be parsed as a date.
Accepted format: input must be in YYYY-MM-DD form — date only, no time component. Other formats (MM/DD/YYYY, written-out months, ISO 8601 strings with a time component) are not parsed and return blank. See Calculations troubleshooting for patterns.
Returns the day of the month (1-31) from a date.Syntax: DAY(date)Business Example:
Arguments:
  • date: Date to extract day from
Returns a number between 1 and 31.
Returns the month (1-12) from a date.Syntax: MONTH(date)Business Example:
Arguments:
  • date: Date to extract month from
Returns a number between 1 (January) and 12 (December).
Returns the year from a date.Syntax: YEAR(date)Business Example:
Arguments:
  • date: Date to extract year from
Returns a four-digit year number.
Returns the hour (0-23) from a datetime.Syntax: HOUR(datetime)Business Example:
Arguments:
  • datetime: Datetime to extract hour from
Returns a number between 0 (midnight) and 23 (11 PM).
Returns the minute (0-59) from a datetime.Syntax: MINUTE(datetime)Business Example:
Arguments:
  • datetime: Datetime to extract minute from
Returns a number between 0 and 59.
Returns the second (0-59) from a datetime.Syntax: SECOND(datetime)Business Example:
Arguments:
  • datetime: Datetime to extract second from
Returns a number between 0 and 59.
Returns the day of the week (1-7) for a date.Syntax: WEEKDAY(date, [type])Business Example:
Arguments:
  • date: Date to get weekday from
  • type: [OPTIONAL] 1=Sun-Sat (1-7), 2=Mon-Sun (1-7), 3=Mon-Sun (0-6)
Type 1 (default): Sunday=1, Monday=2, …, Saturday=7

Text Functions

Joins multiple text values into a single string.Syntax: CONCAT(text1, text2, ...)Business Example:
Arguments:
  • text1, text2, ...: Text values to join together
Various field types are automatically converted to text for concatenation.
CONCAT is the only way to join text values. The + operator is for numeric addition only — it does not concatenate strings, even though it does in some other languages. See Calculations troubleshooting.
Calculations cannot insert a raw newline inside CONCAT — there is no CHAR or CHR function, and '\n' is treated as two literal characters. For multi-line output, build the string in an Execute Script action. See Adding a newline between concatenated values.
Converts text to uppercase letters.Syntax: UPPER(text)Business Example:
Arguments:
  • text: Text to convert to uppercase
Useful for standardizing data entry and comparisons.
Converts text to lowercase letters.Syntax: LOWER(text)Business Example:
Arguments:
  • text: Text to convert to lowercase
Use when you need case-insensitive comparisons or normalized text (for example, email addresses).
Extracts characters from the beginning of a string.Syntax: LEFT(text, number_of_characters)Business Example:
Arguments:
  • text: String to extract from
  • number_of_characters: Number of characters to extract
Returns the entire string if requested length exceeds string length.
Extracts characters from the end of a string.Syntax: RIGHT(text, number_of_characters)Business Example:
Arguments:
  • text: String to extract from
  • number_of_characters: Number of characters to extract
Returns the entire string if requested length exceeds string length.
Extracts substring from specified position.Syntax: MID(text, start_position, number_of_characters)Business Example:
Arguments:
  • text: String to extract from
  • start_position: Starting position (1-based)
  • number_of_characters: Number of characters to extract
Position counting starts at 1, not 0.
Returns position of first case-sensitive substring match.Syntax: FIND(search_text, text_to_search, [start_position])Business Example:
Arguments:
  • search_text: Text to find
  • text_to_search: Text to search within
  • start_position: [OPTIONAL] Starting position for search
Returns 0 if text not found. Case-sensitive search.
Returns position of first case-insensitive substring match.Syntax: SEARCH(search_text, text_to_search, [start_position])Business Example:
Arguments:
  • search_text: Text to find
  • text_to_search: Text to search within
  • start_position: [OPTIONAL] Starting position for search
Returns 0 if text not found. Case-insensitive search.
Replaces text occurrences in a string.Syntax: SUBSTITUTE(text, old_text, new_text)Business Example:
Arguments:
  • text: Original text
  • old_text: Text to replace
  • new_text: Replacement text
Replaces ALL occurrences of old_text with new_text.
Removes whitespace from the beginning and end of a string.Syntax: TRIM(text)Business Example:
Arguments:
  • text: Text to trim
Useful for cleaning imported data or user input that may contain accidental whitespace. Spaces between words are preserved.
Returns the number of characters in a string.Syntax: LEN(text)Business Example:
Arguments:
  • text: Text to measure
Useful for data validation and formatting checks.
Concatenates unique values from a related field.Syntax: STRING_AGG_UNIQUE(related_field, delimiter)Business Example:
Arguments:
  • related_field: Field from related records to concatenate
  • delimiter: Text to put between each value
Automatically removes duplicates before concatenating.
Accepted input types: single-value text only, supplied via a related-field aggregation. Passing a MULTI_PICKLIST field or an array-shaped value raises Invalid Type Error. There is no supported way to aggregate a multi-picklist field directly in a calculation — do the work in Execute Script instead. See also Calculations troubleshooting.
Splits a string into an array of substrings using a delimiter.Syntax: SPLIT(text, delimiter)Business Example:
Arguments:
  • text: String to split
  • delimiter: Character or string to split on
Returns an array of substrings. An empty delimiter ('') splits the text into individual characters. Returns blank if the input is blank.
SPLIT returns an array, but selecting a single element from the result is not currently supported in calculations. To extract “the part before the dash” or similar, use LEFT/RIGHT/MID combined with FIND/SEARCH instead — see Calculations troubleshooting for patterns.
Converts numbers or dates to text format.Syntax: TEXT(value)Business Example:
Arguments:
  • value: Number or date to convert
Useful when you need to treat numbers as text for concatenation.
TEXT does not accept a format string. It returns the value’s default text representation — there is no second argument to control output (no 'YYYY-MM-DD', 'MM/DD/YYYY', or similar). To produce a specific date or datetime string, extract the parts with YEAR, MONTH, DAY, HOUR, MINUTE, SECOND and assemble them with CONCAT:
Pad single-digit months and days yourself if you need zero-padding (for example with IF(MONTH(...) < 10, CONCAT('0', TEXT(MONTH(...))), TEXT(MONTH(...)))).
Converts text to a number.Syntax: VALUE(text)Business Example:
Arguments:
  • text: Text to convert to number
Returns blank if text cannot be converted to a number.
Repeats a string a specified number of times.Syntax: REPT(text, number_of_times)Business Example:
Arguments:
  • text: String to repeat
  • number_of_times: Number of repetitions
Use for padding, separators, or repeating a character a fixed number of times.
Extracts text using a regular expression pattern.Syntax: REGEXEXTRACT(text, pattern)
Escape backslashes in regex patterns. Calculation strings parse \ as an escape character, so any regex metacharacter that uses a backslash must be written with a doubled backslash. Use '\\d' (not '\d'), '\\s+', '\\.', '\\(\\d{3}\\)', etc. A single backslash will be stripped before the regex engine sees the pattern, causing the match to silently fail and return an empty value. For literal characters that don’t strictly need escaping in regex (such as a pipe), prefer a character class — '[|]' — to sidestep escaping entirely. This applies to REGEXEXTRACT, REGEXMATCH, and REGEXREPLACE.
Business Example:
Arguments:
  • text: Text to extract from
  • pattern: Regular expression pattern
Requires knowledge of regular expressions. Use with caution.
Returns the first match only, not a list of matches. There is no built-in way to extract every match in one call.
Patterns follow Java-style regex syntax. Most expressions port unchanged from JavaScript, Python, or PCRE, but watch for escape handling and a few advanced constructs. See Calculations troubleshooting for the differences that matter.
Tests if text matches a regular expression pattern.Syntax: REGEXMATCH(text, pattern)Business Example:
Arguments:
  • text: Text to test
  • pattern: Regular expression pattern
Returns TRUE if pattern matches, FALSE otherwise.
REGEXMATCH does not enforce input format. It only returns a boolean — it does not block saving a record, display a validation error to the user, or revert a bad value on its own. To act on a non-match, use the result in an automation (for example, block a stage transition, send a notification, or set a status flag when REGEXMATCH returns FALSE). To require a format on the form itself, use the Required flag and Helper Text in the Form Builder — there is no built-in regex mask on text fields.
Patterns follow Java-style regex syntax. See Calculations troubleshooting for syntax differences if you’re porting patterns from another flavor.
Replaces text using regular expression patterns.Syntax: REGEXREPLACE(text, pattern, replacement, [case_insensitive])Business Example:
Arguments:
  • text: Text to modify
  • pattern: Regular expression pattern
  • replacement: Replacement text
  • case_insensitive: [OPTIONAL] TRUE for case-insensitive matching
Advanced feature requiring regex knowledge.
Replaces all matches of the pattern in the string, not just the first.
Patterns follow Java-style regex syntax. Backreferences in the replacement string use $1, $2, etc. See Calculations troubleshooting for syntax differences if you’re porting patterns from another flavor.
Escapes special characters in a string for use in JSON.Syntax: JSON_ESCAPE(text)Business Example:
Arguments:
  • text: Text to escape
This function is useful for safely embedding text into JSON payloads.

Send API Request

Learn how to send JSON data to external systems.

JSON File Reader

Learn how to parse and import data from JSON files.
Unescapes special characters in a JSON string.Syntax: JSON_UNESCAPE(text)Business Example:
Arguments:
  • text: Text to unescape
This is the inverse of JSON_ESCAPE, useful for parsing data from JSON payloads.

Send API Request

Learn how to send JSON data to external systems.

JSON File Reader

Learn how to parse and import data from JSON files.

Mathematical Functions

Raises a number to a specified power.Syntax: POWER(base, exponent)Business Example:
Arguments:
  • base: Base number
  • exponent: Power to raise to
Any number raised to the power of 0 equals 1.
Calculates the square root of a number.Syntax: SQRT(number)Business Example:
Arguments:
  • number: Number to find square root of
Returns null if the number is negative.

Special Functions

Returns the Boolean value TRUE.Syntax: TRUE()Business Example:
Useful for setting boolean field values and conditional logic.
Returns the Boolean value FALSE.Syntax: FALSE()Business Example:
Useful for setting boolean field values and conditional logic.
Returns a blank/null value.Syntax: BLANK()Business Example:
Represents the absence of data, different from empty string.
Tests if a value is blank/null.Syntax: ISBLANK(value)Business Example:
Arguments:
  • value: Value to test for blankness
Returns TRUE if the value represents an absence of data — an empty text value ('') or a true null both count as blank. Returns FALSE if the value contains any actual data, including a text field whose content is the four-character string null (an actual text value that’s different from a true absence of value) — see Calculations troubleshooting for the pattern to detect that case.
Generates a random UUID (Universally Unique Identifier).Syntax: UUID()Business Example:
Returns a string in format: ‘f81d4fae-7dec-11d0-a765-00a0c91e6bf6’

Troubleshooting

Problem: Your calculation returns blank instead of expected values.Causes & Solutions:
  • Blank input data: Check that referenced fields contain data
  • Invalid field references: Ensure field names are correct and properly quoted
  • Type mismatches: Verify you’re using the right function for your data type
Example Fix:
Prevention:
  • Always test with sample data
  • Use ISBLANK() to check for missing data
  • Validate field names match exactly
Problem: Functions like SUM, COUNT, AVERAGE don’t work with fields from the current record.Solution: These functions only work with related fields. For current record calculations, use operators:
Key Point: Aggregate functions (SUM, COUNT, AVERAGE, etc.) are designed for related data, not individual field operations.
Problem: Date calculations returning unexpected results.Common Fixes:
  • Text dates: Use DATEVALUE() to convert text to proper dates
  • Timezone issues: Ensure consistent timezone handling
  • Format problems: Check date format consistency
Example Fix:
Problem: FIND vs SEARCH, UPPER vs LOWER, concatenation issues.Solutions:
  • FIND: Case-sensitive search
  • SEARCH: Case-insensitive search
  • CONCAT: Joins multiple values
  • Always use single quotes for text literals
Example Fixes:
Problem: Field references not working, getting ‘field not found’ errors.Solutions:
  • Check field names: Must match exactly (case-sensitive)
  • Use proper syntax: HANDLE.”FieldName” format
  • Verify relationships: Ensure fields are properly related
Example Fixes:
Problem: Calculations running slowly or timing out.Solutions:
  • Simplify complex calculations: Break into smaller parts
  • Avoid nested functions: Use intermediate calculations
  • Check data volumes: Large datasets may need optimization
Example Optimization:

Best Practices

These guidelines help keep calculations reliable and easy to maintain.
  • Use descriptive field names that clearly indicate purpose
  • Keep calculations simple and readable
  • Break complex logic into multiple steps
  • Document complex calculations with comments
  • Always check for blank values using ISBLANK()
  • Validate data types before performing operations
  • Use IF statements to handle edge cases
  • Test calculations with various data scenarios
  • Avoid deeply nested functions
  • Use intermediate calculations for complex logic
  • Consider data volume when designing calculations
  • Test performance with realistic data sets
  • Use proper field reference syntax: HANDLE.”FieldName”
  • Always use single quotes for text literals, never double quotes
  • Verify field relationships before using aggregate functions
  • Test calculations thoroughly before deployment
  • Core concepts — Apps, Elements, fields, and how records connect
  • Tables — Calculated columns and spreadsheet-style views of your data
  • Showing relationships — Related records and how aggregates apply to related fields
  • Data best practices — Structuring data so formulas and reports stay maintainable
  • Automation system — Triggers and actions where calculations often appear

Need More Help?

Help & Resources

Support options, self-help topics, and how to reach the team

Support Tickets

Get direct help from our support team

Best Practices Guide

Learn advanced calculation techniques

Video Tutorials

Watch step-by-step calculation examples