Formula reference
Literals, operators and functions for calculations.
Literals and fields
| Write | For |
|---|---|
42, 0.5 |
Number |
"text" |
Text. Double a quote inside it |
true, false, null |
Boolean, empty |
date("2025-06-30") |
A date. It must exist |
[Net amount] |
A field |
[Table › Label] |
A field whose label isn’t unique |
Operators
+ - * /, then = != <> < <= > >=, then not, and, or, with parentheses. Types are never converted for you.
Logic
| Function | Gives |
|---|---|
if(condition, then, else) |
One or the other. An empty condition takes else |
coalesce(a, b, …) |
The first that isn’t empty |
nullif(a, b) |
Empty when they are equal, otherwise a |
is_null(a) |
Whether it is empty |
Numbers
| Function | Gives |
|---|---|
abs(x) |
Without its sign |
round(x, digits) |
Halves away from zero. Digits −10 to 10, 0 if left out |
floor(x), ceil(x) |
Rounded down, rounded up |
Text
| Function | Gives |
|---|---|
concat(a, b, …) |
Joined text. Takes any type and skips empty parts |
upper(t), lower(t), trim(t) |
Changed text |
length(t) |
Number of characters |
substring(t, start, length) |
Part of it. Start counts from 1, length is optional |
contains(t, part) |
Whether it occurs. Case matters |
Dates
| Function | Gives |
|---|---|
year(d), quarter(d), month(d), day(d) |
Numbers |
days_between(start, end) |
Calendar days, negative if end is first |
Aggregates, in measures
sum, avg, min, max, count and count_distinct over one dimension or dimension calculation. They can’t be nested. A measure name alone uses its own aggregation.
Rows, in dimensions
row([Measure]) is the value behind a measure on one row.
Examples
| For | Formula | Role |
|---|---|---|
| Margin % | ([Net amount] - [Cost amount]) / [Net amount] |
Measure |
| Price band | if([List price] >= 100, "Premium", "Standard") |
Dimension |
| Never negative | if([Margin] < 0, 0, [Margin]) |
Measure |
| Full place | concat([City], ", ", [Country]) |
Dimension |
| Basket size | if(row([Quantity]) >= 3, "Bulk", "Single") |
Dimension |
| Customers per store | count_distinct([Customer key]) / count_distinct([Store key]) |
Measure |
Field names come from your model, so yours will differ.
Limits
2,000 characters, 200 operations, 20 levels of nesting, and 20 aggregates, counted after other calculations are expanded. A report holds 30 calculations and a model 200.