# Basic formula

## Overview

Basic formulas allows you to perform base calculation involving other attributes and constant numbers.

For example, you can write :

`"Unit price" * Quantity * VAT - Discount`

This will fetch the values of attributes Unit Price, Quantity, VAT and Discount and display the result in your calculated attribute.

If you need to reference an issue field in your formula, you will need to use Advanced formula

## Syntax

### Operations

Basic formula allows arithmetic operations :

Operation | Example |
---|---|

Addition | load + 5.3 |

Substraction | load - 5.3 |

Multiplication | load * 0.9 |

Division | load / 2 |

### Precedence and grouping

Multiplication and division have priority over addition and substraction. You can use parenthesis to group operations.

Operations precedence

`5 + 2 * 3 = 11`

Grouping

`(5 + 2) * 3 = 21`

## Supported attribute types

You can reference the following attribute types in your formula:

Type | Evaluation | Example |
---|---|---|

Number | Number attributes evaluate to their value in formulas | 12.25 |

Checkbox | Checkboxes evaluate to 1 when checked, 0 otherwise | 1 |

Calculate | Calculate attribute evaluate to the calculation result. This result is a number | 23.21 |

Empty references (attribute value is not set) will evaluate to zero.

## Special cases

### Division by zero

Division by zero

If you divide by zero, an error message 'Division by zero' will be displayed in the attribute in the issue view.

### Circular references

Circular references

If you reference another calculate attribute which in turn references your attribute, this will create a circular reference. And error message 'Circular reference' will be displayed in the attribute in the issue view.

### Error in reference

Reference evaluation error

If an error occurs in the evaluation of a referenced calculate attribute, the error message is displayed in the attribute in the issue view.

Next ➡ **Advanced formula**