Formulas
Calculate a computed property from other properties with a formula: syntax, operators and functions.
Last reviewed September 28, 2026
A formula calculates one value from other properties of the same event, user or table row. For example, revenue - cost gives the margin of each order.
A formula cannot join tables or add up values across rows. For that, write a SQL model in Studio.
Create a formula
- Go to Data → Computed Properties.
- Click New Property.
- Select what the property describes: Events, User properties or Custom table. Click Continue.
- In Type, select the Formula option.
- For events, select the event in On event. Other events get no value. Select Any event to calculate the value for every event.
- Write the formula, or click Ask AI (see below).
- Click Create property. When you edit a formula later, click Save changes.
Vendo checks the formula while you type. If the formula is correct, the editor shows its Result type: Number, Text, True / false or Date. If it is not correct, the editor shows the problem and where it starts.
Insert a property
Type / where a value can go: at the start, after an operator, after ( or after ,. A list of the properties opens. Type to filter the list, then press Enter or Tab to insert the property. Press Esc to close the list.
After a value, / divides. For example, in revenue / the / divides and the list does not open.
You can also click a property below the editor to insert it.
Write a formula with Ask AI
- Click Ask AI on the Formula card. The AI panel opens next to the editor.
- Describe the calculation in plain English. For example: “Margin as a percentage of revenue, rounded to one decimal place”.
- The AI writes a formula with the properties of your workspace. Vendo checks the formula before it shows it to you.
- Click Apply to put the formula in the editor.
- Click Create property or Save changes to save the property.
Nothing is saved until you click Create property or Save changes. If you change the formula after the AI writes it, Apply does not work and the proposal shows Not applied. Ask the AI again.
Syntax
| Write | Meaning | Example |
|---|---|---|
| A property name | The value of that property | revenue |
| A name in backticks | A property name that has spaces or other characters | `order total` |
| Text in single quotes | A text value. Write '' for a quote inside the text | 'paid', 'it''s' |
| A number | A number value | 100, 0.5 |
true, false | True or false | true |
null | No value | null |
( … ) | Calculate this part first | (revenue - cost) / revenue |
A formula can have up to 2,000 characters.
Operators
| Operator | Meaning | Example |
|---|---|---|
+ - * / | Add, subtract, multiply, divide. Division by zero gives no value | revenue / quantity |
= != | Equal, not equal. == and <> also work | status = 'paid' |
< <= > >= | Less than, greater than | revenue > 100 |
and or not | Combine true/false values | revenue > 100 and not refunded |
Vendo calculates in this order: * and /, then + and -, then comparisons, then not, and and or. Use parentheses to change the order.
Functions
| Function | Result |
|---|---|
round(number, digits) | Rounds the number. Without digits, rounds to a whole number. digits is a whole number from 0 to 10 |
floor(number) | Rounds down |
ceil(number) | Rounds up |
abs(number) | The value without its sign |
min(a, b, …) | The smallest number |
max(a, b, …) | The largest number |
if(condition, then, else) | then when the condition is true, else else |
coalesce(a, b, …) | The first value that is not empty |
days_between(start, end) | The number of whole days from start to end |
now() | The current time |
lower(text) | The text in lower case |
upper(text) | The text in upper case |
trim(text) | The text without spaces at the start and end |
length(text) | The number of characters |
concat(a, b, …) | The values joined as text |
contains(text, part) | True when text contains part |
Values and types
- Vendo converts a property to the type that the formula needs. For example, in
revenue - costboth properties become numbers. - If a value cannot be converted, the result is empty. For example, the text
n/agives no number. - A comparison uses the type of the side that is clear. In
revenue > 100both sides are numbers. If no side is clear, Vendo compares them as text. - A formula that is only a property name gives text.
Examples
| Formula | Result |
|---|---|
revenue - cost | The margin |
round((revenue - cost) / revenue * 100, 1) | The margin as a percentage, with one decimal place |
days_between(signup_date, first_order_date) | The days from sign-up to the first order |
if(revenue > 100, 'high', 'standard') | A value tier |
coalesce(utm_source, 'direct') | The source, or direct when there is none |
lower(trim(country)) | The country, cleaned |
Related
- Grouping Rules: sort values into groups with rules
- SQL Models: calculations that join tables or add up rows
- Output Targets: where model outputs attach