Add a calculated column to a dataset
Learn how to create new columns in your dataset using custom formulas. Includes helpful tips, examples, and guidance for effective use.
Availability
Users, Editors, and Admins
All accounts
Feature exclusive to select subscription plans
Calculated columns let you create new values in your dataset by applying custom logic or transformations to your existing data. This is especially useful when you need to:
- Normalize or reformat values for comparison or visualization
- Combine multiple columns into a single result
- Apply conditional logic (e.g., flagging results based on thresholds)
- Perform mathematical operations that aren't available by default
Instead of modifying your source data, calculated columns give you a flexible way to enrich it — right inside the dataset editor.
Add a calculated column to a dataset
- Navigate to the Datasets page and find the dataset you want to update.
- Click the down arrow (
) next to the dataset name and select Edit data.
- In the dataset editing mode, click the + bar at the far right of the table to open the formula input field above the dataset.
- Enter your formula using supported functions, operators, column references, and values.
- Click
Run to preview how the new column will look across all rows.
- If everything looks good, click Save in the top right corner to apply your changes.
Helpful shortcuts
To speed up formula building and reduce the chance of errors, use the following keyboard shortcuts:
- Ctrl + Space – Opens a list of all supported functions you can use in formulas.
- $ – Displays a dropdown of available columns you can insert as parameters.
These shortcuts make it easier to build accurate formulas without needing to memorize every function or column name.
Formula validation and supported inputs
The formula field only accepts specific input types. If your formula contains unsupported elements or syntax errors, an error message will be displayed. You’ll need to correct the formula before you can run or save it.
Supported inputs include:
- Functions
- Operators
- Numeric values* (e.g.,
10
,3.14
) - Text values, enclosed in single quotes (e.g.,
'Completed'
) - Column references, using the $ symbol (e.g.,
$Status
)
* In dataset columns, logical values are automatically cast as numbers — true
becomes 1
, and false
becomes 0
Any input outside of these types will be flagged as invalid.
Caution: Certain characters — such as parentheses, commas, or symbols — are reserved and may cause issues when parsing or validating your formula. To avoid errors, make sure your column names don’t include special characters, or rename columns before referencing them in a formula.
To help you get started, all supported operators and functions are organized by category below.
Operators
Operators perform basic operations on values or expressions. You can think of them as the "glue" that connects, compares, or transforms values within formulas.
Below is a quick overview of the different types of operators. Click a category below to jump to its full explanation.
Arithmetic Operators
These are basic math symbols used to calculate values.
If formulas are recipes, numeric operators are the math utensils you use to prepare your ingredients.
Operator | Description | Example | Result |
---|---|---|---|
+ |
Addition | 2 + 3 |
5 |
- |
Subtraction | 2 - 3 |
-1 |
* |
Multiplication | 2 * 3 |
6 |
/ |
Division | 5 / 2 |
2.5 |
// |
Integer Division (quotient) | 5 // 2 |
2 |
% |
Modulo (remainder) | 5 % 4 |
1 |
^ |
Exponent | 3 ^ 4 |
81 |
! |
Factorial | 4! |
24 |
Comparison Operators
They evaluate the relationship between two values and return true
or false
. They are commonly used in formulas to compare numbers, text, or column values.
You can think of comparison operators like yes/no questions you ask about your data to evaluate relationships between values.
Operator | Description | Example | Result |
---|---|---|---|
< | Less than | 5 < 10 |
true |
> | Greater than | 5 > 10 |
false |
<= | Less than or equal to | 5 <= 5 |
true |
>= |
Greater than or equal to | 5 >= 6 |
false |
= | Equal | 5 = 5 |
true |
!= | Not equal | 5 != 3 |
true |
Logical and Conditional Operators
These operators evaluate conditions and return true/false or determine outcomes based on logic.
- Logical operators like
AND
,OR
, andNOT
help you build complex conditions by combining simpler ones. - Conditional operators like
CASE
orIS NULL
allow you to return specific values depending on which conditions are met.
You can think of logical operators as the building blocks of a test, and conditional expressions as the final decision maker.
Operator | Description |
---|---|
AND |
Returns Example: |
CASE WHEN ... THEN ... [ELSE ...] END |
Returns the result corresponding to the first true condition. If no conditions are true, returns the Example: |
IS NOT NULL |
Returns Example: |
IS NULL |
Returns Example: |
NOT |
Returns Example: |
OR |
Returns Example: |
Functions
Functions perform more advanced, often reusable operations. They take one or more inputs (called arguments) and return a calculated result.
Below is a categorized overview of available functions. Click a category below to jump to its detailed section.
Aggregate Functions
These perform calculations across multiple rows in a dataset, such as summing values or finding an average.
You can think of aggregate functions as "summary tools" — they look at all your data and give you a big-picture number.
Syntax | Description |
AVG(expression) |
Calculates the average (arithmetic mean) of all non-null values in Example: |
COUNT(expression) |
Counts the number of non-null values in Example: |
COUNTDISTINCT(expression) |
Counts the number of unique (distinct) non-null values in Example: |
MAX(expression) |
Returns the maximum value from Example: |
MEDIAN(expression) |
Returns the median value from Example: |
MIN(expression) |
Returns the minimum value from Example: |
STDEV(expression) |
Returns the sample standard deviation of values in Example: |
STDEVP(expression) |
Returns the population standard deviation of values in Example: |
SUM(expression) |
Returns the sum of all values in Example: |
VARIANCE(expression) |
Returns the sample variance of values in Example: |
VARIANCEP(expression) |
Returns the population variance of values in Example: |
Date and Time Functions
Used to extract parts of a date, perform date math, or return the current time.
These are your "calendar helpers" — they help you understand when things happen or calculate time-based differences.
Syntax | Description |
DATEADD(date, number, interval) |
Returns a new date by adding the specified Example: |
DATEDIFF(start_date, end_date, unit) |
Returns the number of Example: |
DAY(date) |
Returns the day of the month (1–31) from the given Example: |
HOUR(date_time) |
Returns the hour (0–23) from the given Example: |
MINUTE(date_time) |
Returns the minute (0–59) from the given Example: |
MONTH(date) |
Returns the month (1–12) from the given Example: |
NOW() |
Returns the current date and time in Coordinated Universal Time (UTC). Example: |
QUARTER(date) |
Returns the quarter (1–4) of the year for the given Example: |
SECOND(date_time) |
Returns the seconds (0–59) from the given Example: |
TODAY() |
Returns the current date with time set to Example: |
WEEK(date) |
Returns the ISO week number (1–53) for the given Example: |
WEEKDAY(date) |
Returns the day of the week (0 = Sunday, 6 = Saturday) for the given Example: |
YEAR(date) |
Returns the year from the given Example: |
Numeric Functions
These apply mathematical formulas to one or more values.
Numeric functions are like a calculator inside your dataset — they help you transform and analyze numerical values.
Syntax | Description |
ABS(number) |
Returns the absolute (non-negative) value of Example: |
CEILING(number) |
Rounds Example: |
FLOOR(number) |
Rounds Example: |
MOD(dividend, divisor) |
Returns the remainder after dividing Example: |
POWER(number, exponent) |
Returns Example: |
SQRT(number) |
Returns the square root of Example: |
Text Functions
Used to manipulate, transform, or extract information from text strings.
These are your "text editors" — perfect for cleaning up or formatting names, tags, and other string data.
Syntax | Description |
CONCAT(value1, value2, ...) |
Joins multiple values into a single string. Example: |
CONTAINS(string, substring) |
Returns Example: |
ENDSWITH(string, substring) |
Returns Example: |
FIND(string, substring) |
Returns the index of the first occurrence of Example: |
LEFT(string, num_chars) |
Returns the first Example: |
LENGTH(string) |
Returns the number of characters in the Example: |
LOWER(string) |
Converts all characters in the Example: |
REPLACE(string, old_substring, new_substring) |
Replaces all occurrences of Example: |
RIGHT(string, num_chars) |
Returns the last Example: |
STARTSWITH(string, substring) |
Returns Example: |
SUBSTRING(string, start, [length]) |
Extracts a substring from the Example: |
TRIM(string) |
Removes whitespace from the beginning and end of the Example: |
UPPER(string) |
Converts all characters in the Example: |
Utility Functions
Simple but powerful functions for handling nulls and basic conditionals.
Utility functions are the "if-this-then-that" tools — they help you make quick decisions in your formulas or set fallbacks.
Syntax | Description |
IF(condition, true_value, false_value) |
Returns Example: |
IFNULL(expression, value_if_null) |
Returns Example: |
Frequently Asked Questions
Can I reference multiple columns in the same formula?
Yes. You can include as many column references as needed by using the $
symbol before each column name (e.g., $Revenue - $Cost
).
Can I use the calculated column to create custom metrics?
Absolutely. Once saved, calculated columns behave like any other column in your dataset and can be used in metric creation.
Will the calculated column update automatically if the source data changes?
Yes. The calculated column is dynamic — it will recalculate automatically whenever the underlying dataset is refreshed.
Still need help?
Visit our community, send us an email, or start a chat in Databox.