Formula fields allow you to create calculated values based on other fields in your dataset. Use formulas to perform mathematical operations, manipulate text, work with dates, and build conditional logic—all automatically computed for every record.
How Formulas Work
Formulas in Atlas reference other fields in the same record to compute a result. The formula is applied to every record in your dataset, and values update automatically when referenced fields change.
- Formulas can use functions, operators, and field references
- Reference fields using the
@symbol followed by the field name:@Price * @Quantity - Formula results are read-only and cannot be manually edited
Adding a Formula Field
- Open your dataset in the data table view
- Click + Add Field in the table header
- Select Formula from the field type dropdown
- Enter your formula in the expression editor
- Choose the output format (Number, Text, Date, etc.)
- Click Create to save
Using AI to Generate Formulas
Atlas can generate formulas from natural language descriptions.
- Click Generate with AI in the formula editor
- Describe what you want to calculate in plain English
- Review the generated formula
- Click Apply to use it, or refine your description
Example prompts:
- "Calculate the total by multiplying price and quantity"
- "Find the number of days between start date and end date"
- "Combine first name and last name with a space"
- "Return 'High' if score is above 80, otherwise 'Low'"
Operators
Binary Operators
| Operator | Description | Example |
|---|---|---|
+ | Addition or string concatenation | @A + @B |
- | Subtraction | @A - @B |
* | Multiplication | @Price * @Quantity |
/ | Division | @Total / @Count |
^ | Exponentiation (power) | @Base ^ 2 |
% | Remainder (modulo) | @Value % 10 |
// | Integer/floor division | @Total // @Count |
> | Greater than | @Score > 80 |
< | Less than | @Age < 18 |
>= | Greater than or equal | @Rating >= 4 |
<= | Less than or equal | @Priority <= 2 |
== | Equal to | @Status == "Active" |
!= | Not equal to | @Type != "Draft" |
&& | Logical AND (both must be true) | @A > 0 && @B > 0 |
|| | Logical OR (at least one must be true) | @A == 1 || @B == 1 |
Unary Operators
| Operator | Description | Example |
|---|---|---|
+ | Positive value | +@Value |
- | Negation | -@Value |
! | Logical NOT | !@IsArchived |
Functions Reference
Math Functions
| Function | Description | Example |
|---|---|---|
ABS(value) | Absolute value | ABS(@Difference) |
CEIL(value) | Round up to nearest integer | CEIL(@Value) |
FLOOR(value) | Round down to nearest integer | FLOOR(@Value) |
ROUND(value, decimals) | Round to decimal places (default 0) | ROUND(@Price, 2) |
SQRT(value) | Square root | SQRT(@Area) |
POW(base, exponent) | Raise to power | POW(@Base, 2) |
EXP(value) | e raised to power | EXP(@Value) |
LOG(value) | Natural logarithm (base e) | LOG(@Value) |
LOG10(value) | Base-10 logarithm | LOG10(@Value) |
MOD(dividend, divisor) | Remainder after division | MOD(@Value, 10) |
FACTORIAL(value) | Factorial of positive integer | FACTORIAL(5) |
Trigonometric Functions
| Function | Description | Example |
|---|---|---|
SIN(value) | Sine (radians) | SIN(@Angle) |
COS(value) | Cosine (radians) | COS(@Angle) |
TAN(value) | Tangent (radians) | TAN(@Angle) |
ASIN(value) | Inverse sine (arcsine) | ASIN(@Value) |
ACOS(value) | Inverse cosine (arccosine) | ACOS(@Value) |
ATAN(value) | Inverse tangent (arctangent) | ATAN(@Value) |
ATAN2(y, x) | Arctangent of y/x with quadrant handling | ATAN2(@Y, @X) |
Statistical Functions
| Function | Description | Example |
|---|---|---|
SUM(*values) | Sum of values | SUM(@Q1, @Q2, @Q3, @Q4) |
MIN(*values) | Minimum value | MIN(@A, @B, @C) |
MAX(*values) | Maximum value | MAX(@A, @B, @C) |
AVERAGE(*values) | Arithmetic mean | AVERAGE(@Score1, @Score2) |
MEAN(*values) | Arithmetic mean (alias) | MEAN(@A, @B, @C) |
MEDIAN(*values) | Median value | MEDIAN(@A, @B, @C) |
STDDEV(*values) | Sample standard deviation | STDDEV(@A, @B, @C) |
VARIANCE(*values) | Sample variance | VARIANCE(@A, @B, @C) |
Text Functions
| Function | Description | Example |
|---|---|---|
CONCATENATE(*values) | Join strings together | CONCATENATE(@First, " ", @Last) |
LEN(value) | Character count | LEN(@Description) |
LOWER(value) | Convert to lowercase | LOWER(@Email) |
UPPER(value) | Convert to uppercase | UPPER(@Code) |
STRIP(value) | Trim whitespace from ends | STRIP(@Name) |
SLICE(value, start, end) | Extract substring | SLICE(@Code, 0, 3) |
REPLACE(value, old, new, count) | Replace occurrences (count optional) | REPLACE(@Phone, "-", "") |
CONTAINS(value, search) | Check if contains substring | CONTAINS(@Tags, "urgent") |
FORMAT(fmt, *values) | Format string with placeholders | FORMAT("{} - {}", @Code, @Name) |
STR(value) | Convert to string | STR(@Number) |
TEXT(value) | Convert to string (alias) | TEXT(@Number) |
Regex Functions
| Function | Description | Example |
|---|---|---|
REGEX_CONTAINS(value, pattern) | Check if matches pattern | REGEX_CONTAINS(@Email, "@.*\\.com") |
REGEX_MATCH(value, pattern) | Check if matches from beginning | REGEX_MATCH(@Code, "[A-Z]{3}") |
REGEX_EXTRACT(value, pattern) | Extract first match | REGEX_EXTRACT(@Text, "\\d+") |
REGEX_REPLACE(value, pattern, replacement, count) | Replace pattern matches | REGEX_REPLACE(@Phone, "\\D", "") |
Date & Time Functions
| Function | Description | Example |
|---|---|---|
NOW() | Current date and time | NOW() |
TODAY() | Current date | TODAY() |
YEAR(value) | Extract year | YEAR(@Created) |
MONTH(value) | Extract month (1-12) | MONTH(@Date) |
DAY(value) | Extract day of month | DAY(@Date) |
HOUR(value) | Extract hour | HOUR(@Timestamp) |
MINUTE(value) | Extract minute | MINUTE(@Timestamp) |
SECOND(value) | Extract second | SECOND(@Timestamp) |
WEEKDAY(value) | Day of week (Monday=0, Sunday=6) | WEEKDAY(@Date) |
WEEKNUM(value) | Week number (ISO 8601) | WEEKNUM(@Date) |
ADD_MONTHS(value, months) | Add months to date | ADD_MONTHS(@Start, 3) |
ADD_YEARS(value, years) | Add years to date | ADD_YEARS(@Start, 1) |
TIMESTAMP(value) | Convert to timestamp | TIMESTAMP(@DateString) |
FROM_UNIX(value) | Convert Unix timestamp to date | FROM_UNIX(@UnixTime) |
TO_UNIX(value) | Convert date to Unix timestamp | TO_UNIX(@Date) |
Time Duration Constants
Use these with date arithmetic:
| Function | Description | Example |
|---|---|---|
D() | One day | @Date + 7 * D() |
H() | One hour | @Time + 2 * H() |
M() | One minute | @Time + 30 * M() |
S() | One second | @Time + 45 * S() |
MS() | One millisecond | @Time + 500 * MS() |
W() | One week | @Date + 2 * W() |
Logical Functions
| Function | Description | Example |
|---|---|---|
IF(condition, true_value, false_value) | Conditional value | IF(@Score > 80, "Pass", "Fail") |
CASE(*args) | Multiple conditions with values | CASE(@Score >= 90, "A", @Score >= 80, "B", "C") |
NOT(value) | Negate boolean | NOT(@IsArchived) |
TRUE() | Boolean true constant | TRUE() |
FALSE() | Boolean false constant | FALSE() |
BLANK(value) | Check if value is missing/null | BLANK(@Notes) |
FILL_BLANK(value, fill) | Replace missing values (default 0) | FILL_BLANK(@Score, 0) |
Conversion Functions
| Function | Description | Example |
|---|---|---|
INT(value) | Convert to integer | INT(@Price) |
FLOAT(value) | Convert to decimal | FLOAT(@Text) |
STR(value) | Convert to string | STR(@Number) |
TEXT(value) | Convert to string | TEXT(@Date) |
TIMESTAMP(value) | Convert to timestamp | TIMESTAMP(@DateStr) |
Constants
| Function | Description | Value |
|---|---|---|
PI() | Mathematical constant π | 3.14159... |
E() | Euler's number | 2.71828... |
Geographic Functions
| Function | Description | Example |
|---|---|---|
ST_Area(geom) | Area of polygon | ST_Area(@geometry) |
ST_Perimeter(geom) | Perimeter of polygon | ST_Perimeter(@geometry) |
ST_Length(geom) | Length of line | ST_Length(@geometry) |
ST_Centroid(geom) | Center point of geometry | ST_Centroid(@geometry) |
ST_X(geom) | X coordinate of point | ST_X(@geometry) |
ST_Y(geom) | Y coordinate of point | ST_Y(@geometry) |
Formula Examples
Calculate Total Price
Code
@Unit Price * @QuantityApply Discount
Code
@Subtotal * (1 - @Discount / 100)Full Name from Parts
Code
CONCATENATE(@First Name, " ", @Last Name)Days Until Due
Code
(@Due Date - TODAY()) / D()Add 30 Days to Date
Code
@Start Date + 30 * D()Status Based on Date
Code
IF(@Due Date < TODAY(), "Overdue", IF(@Due Date == TODAY(), "Due Today", "Upcoming"))Grade from Score (using CASE)
Code
1CASE(
2 @Score >= 90, "A",
3 @Score >= 80, "B",
4 @Score >= 70, "C",
5 @Score >= 60, "D",
6 "F"
7)Handle Missing Values
Code
FILL_BLANK(@Score, 0)Extract Numbers from Text
Code
REGEX_EXTRACT(@Text, "\\d+")Format Currency
Code
FORMAT("${:.2f}", @Price)Calculate Age in Years
Code
(TODAY() - @Birth Date) / D() / 365Area in Square Kilometers
Code
ST_Area(@geometry) / 1000000Output Formatting
After creating a formula, configure how results are displayed:
| Output Type | Formatting Options |
|---|---|
| Number | Decimal places, thousands separator |
| Currency | Currency symbol, decimal places |
| Percentage | Decimal places |
| Date | Date format pattern |
| Text | No additional formatting |
Formula Editor Features
The formula editor includes:
- Syntax highlighting - Functions, fields, numbers, and text are color-coded
- Autocomplete - Suggestions for functions and field names as you type
- Error detection - Real-time validation with error messages
- Field picker - Click
@to browse and insert field references - Preview - See calculated results before saving
Troubleshooting
| Issue | Solution |
|---|---|
| Formula returns blank | Check that referenced fields have values. Use FILL_BLANK() for fallbacks. |
| Division by zero | Add a condition: IF(@Divisor != 0, @Value / @Divisor, 0) |
| Date calculation wrong | Ensure fields are Date type, not Text. Use duration constants like D(). |
| Text not concatenating | Use CONCATENATE() or + operator. Numbers may need STR() conversion. |
| Unexpected results | Check operator precedence. Use parentheses to clarify order. |
Formulas vs Other Computed Fields
| Field Type | Use Case |
|---|---|
| Formula | Calculate values from fields in the same record |
| Lookup | Display values from linked records |
| AI Field | Generate content using natural language instructions |
| Area/Perimeter | Auto-calculated from geometry (system fields) |