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
Function Reference
Business Examples
Troubleshooting
Quick Start
New to calculations? Start with these patterns for totals, text, dates, and conditional logic.Most Used Functions
Basic Math: SUM, AVERAGE, COUNT
Basic Math: SUM, AVERAGE, COUNT
Text Operations: CONCAT, UPPER, LOWER
Text Operations: CONCAT, UPPER, LOWER
Date Operations: NOW, DATEADD, DATEDIF
Date Operations: NOW, DATEADD, DATEDIF
Conditional Logic: IF, AND
Conditional Logic: IF, AND
Common date recipes
The most-asked date questions, with the exact syntax to use.Get today’s date
Elementum does not have aTODAY() 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:
Add days to a date
UseDATEADD(unit, value, date) with an unquoted unit token like DAY or MONTH:
Subtract days from a date
Pass a negative value toDATEADD:
DATEADD handles month and year rollovers automatically — adding days across the end of a month advances into the next month as expected.
Business Examples
- Sales & Revenue
- Customer Management
- Inventory & Operations
Calculate Monthly Sales Performance
Function Reference
Logical Functions
AND - All conditions must be true
AND - All conditions must be true
AND(condition1, condition2, ...)Business Example:condition1, condition2, ...: Logical expressions that evaluate to TRUE/FALSE
OR - At least one condition must be true
OR - At least one condition must be true
OR(condition1, condition2, ...)Business Example:condition1, condition2, ...: Logical expressions that evaluate to TRUE/FALSE
IF - Conditional logic
IF - Conditional logic
IF(condition, value_if_true, value_if_false)Business Example:condition: Logical expressionvalue_if_true: Value returned when condition is TRUEvalue_if_false: Value returned when condition is FALSE
IFS - Multiple conditions in order
IFS - Multiple conditions in order
IFS(condition1, value1, condition2, value2, ...)Business Example:condition1, condition2, ...: Logical expressions evaluated in ordervalue1, value2, ...: Value returned for the corresponding condition when it is the first to evaluate to TRUE
Numeric Functions
AVERAGE - Calculate mean value
AVERAGE - Calculate mean value
AVERAGE(related_field)Business Example:related_field: Field from related records to average
COUNTIF - Count records meeting criteria
COUNTIF - Count records meeting criteria
COUNTIF(related_field, criterion)Business Example:related_field: Field from related records to countcriterion: Condition to meet (supports comparison operators)
SUM(IF(RELATED."Field" = 'Paid', 1, 0))COUNTUNIQUE - Count unique values
COUNTUNIQUE - Count unique values
COUNTUNIQUE(related_field)Business Example:related_field: Field from related records to count unique values
MAX - Find maximum value
MAX - Find maximum value
MAX(value1, value2, ...)Business Example:value1, value2, ...: Values to compare
MIN - Find minimum value
MIN - Find minimum value
MIN(value1, value2, ...)Business Example:value1, value2, ...: Values to compare
ROUND - Round numbers
ROUND - Round numbers
ROUND(number, [decimal_places])Business Example:number: Number to rounddecimal_places: [OPTIONAL] Number of decimal places (default: 0)
STDEV - Calculate standard deviation
STDEV - Calculate standard deviation
STDEV(related_field)Business Example:related_field: Field from related records to calculate standard deviation
SUMIF - Sum values meeting criteria
SUMIF - Sum values meeting criteria
SUMIF(related_field, criterion)Business Example:related_field: Field from related records to sumcriterion: Condition values must meet
Date and Time Functions
NOW - Current date and time
NOW - Current date and time
NOW()Business Example:TODAY() function — use NOW() and, if you need date-only, wrap it in DATE(YEAR(NOW()), MONTH(NOW()), DAY(NOW())).DATEADD - Add or subtract time from a date
DATEADD - Add or subtract time from a date
DATEADD(unit, value, date)Business Example:unit: Date/time unit token — for example,DAYorMONTH. 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.DATE - Create date from components
DATE - Create date from components
DATE(year, month, day)Business Example:year: Four-digit yearmonth: Month (1-12)day: Day of month (1-31)
DATETIME - Create datetime from components
DATETIME - Create datetime from components
DATETIME(year, month, day, hour, minute, second)Business Example:year: Four-digit yearmonth: Month (1-12)day: Day of month (1-31)hour: Hour (0-23)minute: Minute (0-59)second: Second (0-59)
DATEDIF - Calculate date differences
DATEDIF - Calculate date differences
DATEDIF(start_date, end_date, unit)Business Example:start_date: Beginning dateend_date: End dateunit: ‘Y’ for years, ‘M’ for months, ‘D’ for days
DATETIME_TRUNC - Truncate datetime
DATETIME_TRUNC - Truncate datetime
DATETIME_TRUNC(datetime, unit)Business Example:datetime: Datetime to truncateunit: YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND
DATEVALUE - Convert text to date
DATEVALUE - Convert text to date
DATEVALUE(text_date)Business Example:text_date: Text representation of a date
DAY - Extract day from date
DAY - Extract day from date
DAY(date)Business Example:date: Date to extract day from
MONTH - Extract month from date
MONTH - Extract month from date
MONTH(date)Business Example:date: Date to extract month from
YEAR - Extract year from date
YEAR - Extract year from date
YEAR(date)Business Example:date: Date to extract year from
HOUR - Extract hour from datetime
HOUR - Extract hour from datetime
HOUR(datetime)Business Example:datetime: Datetime to extract hour from
MINUTE - Extract minute from datetime
MINUTE - Extract minute from datetime
MINUTE(datetime)Business Example:datetime: Datetime to extract minute from
SECOND - Extract second from datetime
SECOND - Extract second from datetime
SECOND(datetime)Business Example:datetime: Datetime to extract second from
WEEKDAY - Get day of week
WEEKDAY - Get day of week
WEEKDAY(date, [type])Business Example:date: Date to get weekday fromtype: [OPTIONAL] 1=Sun-Sat (1-7), 2=Mon-Sun (1-7), 3=Mon-Sun (0-6)
Text Functions
CONCAT - Join text together
CONCAT - Join text together
CONCAT(text1, text2, ...)Business Example:text1, text2, ...: Text values to join together
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.UPPER - Convert to uppercase
UPPER - Convert to uppercase
UPPER(text)Business Example:text: Text to convert to uppercase
LOWER - Convert to lowercase
LOWER - Convert to lowercase
LOWER(text)Business Example:text: Text to convert to lowercase
LEFT - Extract from start of text
LEFT - Extract from start of text
LEFT(text, number_of_characters)Business Example:text: String to extract fromnumber_of_characters: Number of characters to extract
RIGHT - Extract from end of text
RIGHT - Extract from end of text
RIGHT(text, number_of_characters)Business Example:text: String to extract fromnumber_of_characters: Number of characters to extract
MID - Extract from middle of text
MID - Extract from middle of text
MID(text, start_position, number_of_characters)Business Example:text: String to extract fromstart_position: Starting position (1-based)number_of_characters: Number of characters to extract
FIND - Find text position (case-sensitive)
FIND - Find text position (case-sensitive)
FIND(search_text, text_to_search, [start_position])Business Example:search_text: Text to findtext_to_search: Text to search withinstart_position: [OPTIONAL] Starting position for search
SEARCH - Find text position (case-insensitive)
SEARCH - Find text position (case-insensitive)
SEARCH(search_text, text_to_search, [start_position])Business Example:search_text: Text to findtext_to_search: Text to search withinstart_position: [OPTIONAL] Starting position for search
SUBSTITUTE - Replace text
SUBSTITUTE - Replace text
SUBSTITUTE(text, old_text, new_text)Business Example:text: Original textold_text: Text to replacenew_text: Replacement text
TRIM - Remove leading and trailing spaces
TRIM - Remove leading and trailing spaces
TRIM(text)Business Example:text: Text to trim
LEN - Get text length
LEN - Get text length
LEN(text)Business Example:text: Text to measure
STRING_AGG_UNIQUE - Concatenate unique values
STRING_AGG_UNIQUE - Concatenate unique values
STRING_AGG_UNIQUE(related_field, delimiter)Business Example:related_field: Field from related records to concatenatedelimiter: Text to put between each value
SPLIT - Split text into parts
SPLIT - Split text into parts
SPLIT(text, delimiter)Business Example:text: String to splitdelimiter: Character or string to split on
'') splits the text into individual characters. Returns blank if the input is blank.TEXT - Convert to text
TEXT - Convert to text
TEXT(value)Business Example:value: Number or date to convert
VALUE - Convert text to number
VALUE - Convert text to number
VALUE(text)Business Example:text: Text to convert to number
REPT - Repeat text
REPT - Repeat text
REPT(text, number_of_times)Business Example:text: String to repeatnumber_of_times: Number of repetitions
REGEXEXTRACT - Extract with regex
REGEXEXTRACT - Extract with regex
REGEXEXTRACT(text, pattern)Business Example:text: Text to extract frompattern: Regular expression pattern
REGEXMATCH - Test regex pattern
REGEXMATCH - Test regex pattern
REGEXMATCH(text, pattern)Business Example:text: Text to testpattern: Regular expression pattern
REGEXREPLACE - Replace with regex
REGEXREPLACE - Replace with regex
REGEXREPLACE(text, pattern, replacement, [case_insensitive])Business Example:text: Text to modifypattern: Regular expression patternreplacement: Replacement textcase_insensitive: [OPTIONAL] TRUE for case-insensitive matching
$1, $2, etc. See Calculations troubleshooting for syntax differences if you’re porting patterns from another flavor.JSON_ESCAPE - Escape JSON string
JSON_ESCAPE - Escape JSON string
JSON_ESCAPE(text)Business Example:text: Text to escape
Send API Request
JSON File Reader
JSON_UNESCAPE - Unescape JSON string
JSON_UNESCAPE - Unescape JSON string
JSON_UNESCAPE(text)Business Example:text: Text to unescape
Send API Request
JSON File Reader
Mathematical Functions
POWER - Raise to power
POWER - Raise to power
POWER(base, exponent)Business Example:base: Base numberexponent: Power to raise to
SQRT - Square root
SQRT - Square root
SQRT(number)Business Example:number: Number to find square root of
Special Functions
TRUE - Boolean TRUE
TRUE - Boolean TRUE
TRUE()Business Example:FALSE - Boolean FALSE
FALSE - Boolean FALSE
FALSE()Business Example:BLANK - Return blank value
BLANK - Return blank value
BLANK()Business Example:ISBLANK - Test if blank
ISBLANK - Test if blank
ISBLANK(value)Business Example:value: Value to test for blankness
'') 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.UUID - Generate unique ID
UUID - Generate unique ID
UUID()Business Example:Troubleshooting
Common Error: Blank Results
Common Error: Blank Results
- 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
- Always test with sample data
- Use ISBLANK() to check for missing data
- Validate field names match exactly
Common Error: Function Not Working with Current Record
Common Error: Function Not Working with Current Record
Common Error: Date Calculation Issues
Common Error: Date Calculation Issues
- Text dates: Use
DATEVALUE()to convert text to proper dates - Timezone issues: Ensure consistent timezone handling
- Format problems: Check date format consistency
Common Error: Text Function Confusion
Common Error: Text Function Confusion
- FIND: Case-sensitive search
- SEARCH: Case-insensitive search
- CONCAT: Joins multiple values
- Always use single quotes for text literals
Common Error: Field Reference Issues
Common Error: Field Reference Issues
- Check field names: Must match exactly (case-sensitive)
- Use proper syntax: HANDLE.”FieldName” format
- Verify relationships: Ensure fields are properly related
Performance Issues
Performance Issues
- Simplify complex calculations: Break into smaller parts
- Avoid nested functions: Use intermediate calculations
- Check data volumes: Large datasets may need optimization
Best Practices
These guidelines help keep calculations reliable and easy to maintain.Naming and Structure
Naming and Structure
- Use descriptive field names that clearly indicate purpose
- Keep calculations simple and readable
- Break complex logic into multiple steps
- Document complex calculations with comments
Data Validation
Data Validation
- 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
Performance Optimization
Performance Optimization
- Avoid deeply nested functions
- Use intermediate calculations for complex logic
- Consider data volume when designing calculations
- Test performance with realistic data sets
Error Prevention
Error Prevention
- 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
Related documentation
- 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