Function reference
Every function the expression language understands — what it takes, what it gives back, whether it works on one entry or a whole column, and a copy-pasteable example.
This page is generated from the engine itself, so it can't drift: if a function is listed here it exists, and its example is one Kaizendex actually runs. For what expressions are and how to think about them, read The expression language first.
How to read the table
- Function — the name and its arguments, in order. An argument ending in
?is optional;…means you can keep adding more. - Gives back — the kind of value you get.
seriesmeans a whole column comes back out, ready to feed into the next function. - Scope — Row works on a single entry (a Formula field), Dataset works on a whole column of your history (the statistics behind a chart), Row + dataset works in both.
- Example — copy it, swap the field names for your own.
Two rules apply to every function on this page and are worth reading once: gaps are skipped, never counted as zero, and a calculation with nothing to work on comes back empty rather than erroring. Both are explained in The expression language.
43 functions, generated straight from the engine — if it is listed here, it works.
Logic
Branching and emptiness checks.
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
empty(value?) | boolean, or the empty value with no argument | Row + dataset | Tests whether a value is empty; called with no argument it yields the empty value itself | if(empty(prop("Notes")), "No notes", prop("Notes")) |
if(condition, then, otherwise) | any | Row + dataset | Picks one of two values depending on a condition; the untaken branch is never evaluated | if(prop("Steps") > 10000, "Great day", "Keep going") |
Math
Arithmetic helpers that work on single numbers (or durations).
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
abs(value) | number | Row + dataset | The absolute value of a number, dropping its sign | abs(prop("Weight") - prop("Target weight")) |
ceil(value) | number | Row + dataset | Rounds a number up to the nearest whole number | ceil(prop("Sleep score")) |
clamp(value, min, max) | number | Row + dataset | Keeps a number inside a range, pulling anything outside it to the nearest bound | clamp(prop("Deep sleep"), 0, 60) |
floor(value) | number | Row + dataset | Rounds a number down to the nearest whole number | floor(prop("Sleep score")) |
max(value, …) | number or duration | Row + dataset | The largest of its arguments — all numbers, or all durations — or the largest sample of a single series | max(prop("Deep sleep"), prop("REM sleep")) |
min(value, …) | number or duration | Row + dataset | The smallest of its arguments — all numbers, or all durations — or the smallest sample of a single series | min(prop("Deep sleep"), prop("REM sleep")) |
round(value, digits?) | number | Row + dataset | Rounds a number to the given number of decimal digits (0 by default) | round(prop("Sleep score"), 1) |
Text
Building and measuring text.
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
concat(…) | text | Row + dataset | Joins its arguments into one piece of text, with no separator | concat(prop("First name"), " ", prop("Last name")) |
length(text) | number | Row + dataset | The number of characters in a piece of text | length(prop("Notes")) |
Date & time
Reading the clock and the gap between two moments.
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
dateBetween(later, earlier, unit) | number | Row + dataset | The gap between two datetimes in "minutes", "hours" or "days" | dateBetween(prop("Wake time"), prop("Bedtime"), "minutes") |
now() | datetime | Row + dataset | The current date and time | dateBetween(now(), prop("Bedtime"), "hours") |
Series
The opaque sample series a wearable records inside one entry — a night of heart-rate readings, say. Reduce one before you can compare or display it.
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
seriesAvg(series) | number | Row + dataset | The average of a series' samples, or empty when it has none | seriesAvg(prop("Heart rate")) |
seriesCount(series) | number | Row + dataset | How many non-empty samples a series holds; a missing series counts as zero | seriesCount(prop("Heart rate")) |
seriesFractionAbove(series, threshold) | number | Row + dataset | The share of a series' samples that sit above a threshold, from 0 to 1 | seriesFractionAbove(prop("Heart rate"), 120) |
seriesFractionBelow(series, threshold) | number | Row + dataset | The share of a series' samples that sit below a threshold, from 0 to 1 | seriesFractionBelow(prop("Heart rate"), 60) |
seriesMax(series) | number | Row + dataset | The highest of a series' samples, or empty when it has none | seriesMax(prop("Heart rate")) |
seriesMin(series) | number | Row + dataset | The lowest of a series' samples, or empty when it has none | seriesMin(prop("Heart rate")) |
Descriptive
Summarising a whole column down to a single number.
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
count(series) | number | Dataset | How many values a column actually holds; gaps and a missing column count as zero | count(prop("Steps")) |
mean(series) | number | Dataset | The average of a column, ignoring gaps; empty when it has nothing to average | mean(prop("Steps")) |
median(series) | number | Dataset | The middle value of a column, ignoring gaps — the typical day when outliers would drag the average | median(prop("Bedtime hour")) |
mode(series) | number | Dataset | The most common value in a column, ignoring gaps; ties resolve to the lowest tied value | mode(prop("Wake hour")) |
percentile(series, p) | number | Dataset | The value a given percentage of a column sits below, with p from 0 to 100 | percentile(prop("Sleep score"), 90) |
stddev(series) | number | Dataset | How spread out a column is, as a sample standard deviation; empty below two values | stddev(prop("Weight")) |
sum(series) | number | Dataset | The total of a column, ignoring gaps; empty when it holds nothing | sum(prop("Calories")) |
variance(series) | number | Dataset | The sample variance of a column — the square of its standard deviation; empty below two values | variance(prop("Weight")) |
Relational
How two columns relate, and how far a value sits from normal.
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
corr(x, y) | number | Dataset | How strongly two columns move together, from -1 to 1; rows missing either value are skipped | corr(prop("Sleep score"), prop("Steps")) |
intercept(x, y) | number | Dataset | Where the best-fit line through two columns crosses x = 0; rows missing either value are skipped | intercept(prop("Day index"), prop("Weight")) |
r2(x, y) | number | Dataset | How much of y's variation the best-fit line explains, from 0 to 1 — the fit's trustworthiness | r2(prop("Day index"), prop("Weight")) |
slope(x, y) | number | Dataset | How much y changes per unit of x on the best-fit line; rows missing either value are skipped | slope(prop("Day index"), prop("Weight")) |
zscore(series) | series | Dataset | Restates a column in standard deviations from its own average; an all-equal column becomes zeros | zscore(prop("Recovery")) |
Sequence
Column in, column out — same length, gaps left where they were, so results stay row-aligned.
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
cumsum(series) | series | Dataset | The running total of a column; a gap stays a gap but the total carries across it | cumsum(prop("Distance")) |
delta(series) | series | Dataset | The row-over-row change in a column; the first row, and either side of a gap, is empty | delta(prop("Weight")) |
lag(series, offset) | series | Dataset | Shifts a column n rows later, so a row can be compared with the one n before it; the first n are empty | lag(prop("Sleep score"), 1) |
longestGap(series) | number | Dataset | The longest unbroken run of false anywhere in a column, where non-zero is true and zero or empty is false | longestGap(prop("Hit protein goal")) |
longestStreak(series) | number | Dataset | The longest unbroken run of true anywhere in a column, where non-zero is true and zero or empty is false | longestStreak(prop("Hit protein goal")) |
rollingAvg(series, window) | series | Dataset | A trailing moving average over the last n rows; the first n-1 rows are empty, never a part-window | rollingAvg(prop("Weight"), 7) |
rollingSum(series, window) | series | Dataset | A trailing moving total over the last n rows; the first n-1 rows are empty, never a part-window | rollingSum(prop("Calories"), 7) |
streak(series) | number | Dataset | The current unbroken run of true at the end of a column, where non-zero is true and zero or empty is false | streak(prop("Hit protein goal")) |
Shaping
Rescaling and bucketing, for histograms and side-by-side comparison.
| Function | Gives back | Scope | What it does | Example |
|---|---|---|---|---|
bucket(value, width) | number | Row + dataset | Snaps a number down to the start of its band, for histogram-style grouping | bucket(prop("Weight"), 5) |
coalesce(value, …) | any | Row + dataset | The first of its arguments that is not empty, or empty when they all are | coalesce(prop("Notes"), "No notes") |
normalize(series) | series | Dataset | Rescales a column to 0..1 between its own lowest and highest values; an all-equal column becomes zeros | normalize(prop("Steps")) |
Not on this list
Operators aren't functions, so they don't appear above — but + - * / %, == != < <= > >=, and and / or / not all work, and prop("Field name") is how you reference your data. See The expression language.
If a function you want isn't here, it doesn't exist yet — there's no hidden list. Ask the assistant what you're trying to work out and it will build it from the pieces above, or tell you it can't.
Next
- The expression language — value types, scope, and worked recipes
- Formulas — putting an expression on a Collection as a read-only field
- Building charts and dashboards — where dataset-scope statistics show up