---
title: Calculations and variables
description: Building bots
---

[Skip to content](https://help.joseflegal.com/calculations-and-variables#main-content)

<https://help.joseflegal.com/kb-tickets/new?hsLang=en>

[![Josef Logo](https://help.joseflegal.com/hs-fs/hubfs/josef-logo-4.png?width=120&height=40&name=josef-logo-4.png)](https://www.joseflegal.com)

Open main navigation

Close main navigation

- <https://help.joseflegal.com/kb-tickets/new>
- [Contact us](https://help.joseflegal.com/kb-tickets/new)

[Contact us](https://help.joseflegal.com/kb-tickets/new?hsLang=en)

 How can we help you?

- There are no suggestions because the search field is empty.

1. [Support](https://help.joseflegal.com/?hsLang=en)
2. [Josef No-Code Automation Platform](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en)
3. [Building bots](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#building-bots)

# Calculations and variables

  

### <iframe height="315" src="https://www.youtube-nocookie.com/embed/OtTkb_Yo0q4" style="margin:" 10px auto; display: block; clear: both; width="560" allowfullscreen></iframe>

  

### **Introduction**

Builders can create **calculations** and use them across the platform in the same way as **[response variables](https://help.joseflegal.com/response-types?hsLang=en)**. Calculations can be inserted into **[documents](https://help.joseflegal.com/creating-a-document-in-the-word-editor?hsLang=en),** [**notifications**](https://help.joseflegal.com/send-notification-emails?hsLang=en), [**messages**](https://help.joseflegal.com/create-messages?hsLang=en) or used to build out rules. 

Check out the walkthrough video above to see them in action.

In this article, you'll learn how to:

- [Access the Variables library](https://help.joseflegal.com/calculations-and-variables#variables-library)
- [Create a variable](https://help.joseflegal.com/calculations-and-variables#create-variable)
- [Insert a variable into a message, document or notification](https://help.joseflegal.com/calculations-and-variables#insert-variable)
- [Troubleshoot invalid calculations](https://help.joseflegal.com/calculations-and-variables#invalid-calculations)
- [Edit a variable](https://help.joseflegal.com/calculations-and-variables#edit-variable)
- [Use the variables overview](https://help.joseflegal.com/calculations-and-variables#variables-overview)

### Variables library

The Variables library contains an overview of all of your bot's response and calculation variables. It's also where you can add or edit calculations. 

Within the Flowchart, List view, or Notifications tabs, the library can be accessed via the tag on the far right of the window. 

In the document editor, click Insert variable to see a list of your bot's variables & calculations.

### Create a variable

First, head to either List View or Flowchart. Then click on the Variables library tag located on the right of the Dashboard. 

![6236122964367](https://help.joseflegal.com/hs-fs/hubfs/Knowledge%20Base%20Import/6236122964367.gif?width=688&height=487&name=6236122964367.gif)

When you first open up the Variables library, you'll see:

- A drop-down field containing a list of existing calculations
- An overview of all of your existing response and calculation variables
- A purple 'Create new variable' button

To build out your first calculation, follow these steps:

**1. Click the Create new variable button**

A sidebar will appear where you can define the contents of your variable. 

**2. Give the variable a name in the Variable name field**

This is for your reference only, similar to a message name. 

**3. Set your Calculation result type**

Choose from the following result types:

- **Number** 
    - A numerical value
- **Date** 
    - A formatted date
- **Percentage** 
    - A percentage value
- **Currency** 
    - A numerical value formatted according to the international currency selected in Dashboard \> My account \> Currency.
- **Duration** 
    - A period of time defined by a number of days, weeks, months or years. The output will be presented as the smallest time unit available e.g. 14 days will be presented as 2 weeks when inserted in documents, notifications or messages.

**4. Create your calculation in the Calculation field**

Start writing the calculation and ensure it matches the result type selected in Step 3. The mathematical order of operations follows the BODMAS rules.

To create a calculation:

1. Click into the Calculation field and insert your response by using the @ key to open a list of available variables.
2. Select a variable from the dropdown. You may also use the insert variable button (x) in the toolbar below.
3. Use standard mathematical operators to add to your calculation. These include:  +, -, /, \*.
4. To validate the operator, hit space or enter/return on your keyboard.
5. After adding your operator, type in numerical values or insert further variables to complete your calculation.

For calculating dates, you can also type a number (e.g. 12) and then click on the token to select the duration timeframe. 

You can also type in the number of days, weeks, months, and years (e.g. “1day” or “2weeks”, or “3months”) and confirm with your space/enter key. 

Please note:

- There should be no space between the number and the time unit. Date calculations include the first day and exclude the last day (e.g. 1 June - 5 June = 4 days)
- 1 week = 7 days
- 1 month = 30 days
- 1 year = 365 days

Once you’ve built out your calculation, click on the Create button to finalise the variable. 

Your variable can now be accessed in the Variables library workspace.

### Invalid calculations

You may see some of the following messages when adding your calculations. Here's what they mean:

```
It looks like your formula contains invalid characters 
```

- The calculation field contains invalid characters (e.g. duration + #)

```
It looks like your formula is missing brackets
```

- Bracket pairs are incomplete (i.e. missing an open or closed bracket)

```
It looks like your formula is missing an operator, or is incomplete 
```

- The calculation is incomplete (e.g. ends with an operator)
- The calculation has two operators after another (e.g. value + - value)
- The calculation contains values/variables without an operator

```
Formula is required
```

- The field is empty

```
It looks like your formula contains a type combination that isn't allowed 
```

- The variable/value combination is invalid (e.g. date + currency)
- The variable/value and operator combination is invalid (e.g. date \* date)
- The variable/value is not allowed (e.g. decimals in durations, such as 1.7 months)

```
Oh no, your formula isn't matching the result type.
```

- The calculation isn't matching the result type selected

### Insert a variable

Variables can be inserted into bot [messages](https://help.joseflegal.com/create-messages?hsLang=en), [notifications](https://help.joseflegal.com/send-notification-emails?hsLang=en), and/or generated [documents](https://help.joseflegal.com/creating-a-document-in-the-word-editor?hsLang=en) via the Insert variable button. Here's where to find it:

**Messages**

In the toolbar in the bottom right of the Message text field

**Notifications**

In the toolbar in the bottom right of the Content field

**Documents (in both the Word & Web editors)**  
In the top toolbar

### Edit a variable

To edit your variable, simply follow these steps:

1. Click on the Variables library tag
2. Either: 
     - Select the variable you'd like to edit from the drop-down, or
     - Click on the variable pill in the Overview to open the variable to edit

### Delete a variable

Click the red Delete button within the Variables library sidebar and follow the prompts.

### Variables overview

Each variable has an overview that tells the builder where in their bot a variable is used. You can find the variables overview in the Variables library.

- [Josef Q](https://help.joseflegal.com/josef-q?hsLang=en#main-content)

    - [Using tools](https://help.joseflegal.com/josef-q?hsLang=en#using-tools)
    - [Training tools](https://help.joseflegal.com/josef-q?hsLang=en#training-tools)
    - [Preparing a knowledge base](https://help.joseflegal.com/josef-q?hsLang=en#preparing-a-knowledge-base)
    - [Release note (Josef Q)](https://help.joseflegal.com/josef-q?hsLang=en#release-note-josef-q)
    - [Creating tools](https://help.joseflegal.com/josef-q?hsLang=en#creating-tools)
    - [Managing tools and accounts](https://help.joseflegal.com/josef-q?hsLang=en#managing-tools-and-accounts)
    - [Integrations](https://help.joseflegal.com/josef-q?hsLang=en#integrations)
    - [Resources](https://help.joseflegal.com/josef-q?hsLang=en#resources)
    - [Monitoring & maintaining tools](https://help.joseflegal.com/josef-q?hsLang=en#monitoring-maintaining-tools)
- [Josef No-Code Automation Platform](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#main-content)

    - [Building bots](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#building-bots)
    - [Integrations](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#integrations)
    - [Notifications and workflows](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#notifications-and-workflows)
    - [Document creation](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#document-creation)
    - [Managing bots](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#managing-bots)
    - [Testing, troubleshooting and editing](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#testing-troubleshooting-and-editing)
    - [Launching](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#launching)
    - [Single Sign-On](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#single-sign-on)
    - [FAQs](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#faqs)
    - [Getting started on Josef no-code](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#getting-started-on-josef-no-code)
    - [Release notes & FAQs for Josef no-code](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#release-notes-faqs-for-josef-no-code)
    - [Managing accounts](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#managing-accounts)
    - [Reporting](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#reporting)
    - [Formatting a bot](https://help.joseflegal.com/josef-no-code-automation-platform?hsLang=en#formatting-a-bot)

[![Chill listening crop-3](https://help.joseflegal.com/hs-fs/hubfs/Josef%20logo.png?width=72&height=24&name=Josef%20logo.png "Chill listening crop-3")](http://joseflegal.com)

[support@joseflegal.com](mailto:support@joseflegal.com) 

<https://twitter.com/joseflegal/> <https://www.linkedin.com/company/joseflegal/> [mailto:support@joseflegal.com](mailto:support@joseflegal.com)

Copyright © 2025, Josef Legal