Use Formulas to calculate metrics important for you.

So far Formula field supports `Number`

only (`Decimal`

or `Integer`

). More data types will be added later (`Date`

, `Text`

, etc).

Formula is a Field, and it means you can do the same things with Formula Field as with all other fields. For example, you can display Formula Field on entity card, filter and sort by Formula Field, use it inside Charts.

To create a formula, navigate to any Type and click Add Field or Relation, then select Formula.

You will see Formula field creation form. In this form you should specify Field Name, Field Type (Integer or Decimal) and Formula itself:

Formula setup can be challenging, so let’s explore some examples based on the following domain:

Here we have Product with a collection of Epics, and Epic has a collection of Features. Let’s say, we have Estimate field in Feature and want to calculate Total Estimate inside Epic. The formula will look like that:

`Total Estimate Field inside Epic`

Features.Sum(Estimate)

Now we want to add Total Estimate Field into Product entity to roll-up all Epics. Here is how you do it

`Total Estimate Field inside Product`

Epics.Sum([Total Estimate])

Here are more examples:

Inside Epic we want to calculate effort of all completed Features. We create Completed Effort Formula Field:

`Completed Effort Field inside Epic:`

Features.Filter(State.Final = true).Sum(Estimate)

And let’s define Not Done Effort Field

`Not Done Effort Field inside Epic:`

Features.Filter(State.Final != true).Sum(Estimate)

Now we can specify Epic Progress Field like this:

`Progress Field inside Epic:`

[Completed Effort] / [Total Estimate] * 100

## Reference

If you have a space symbol in Field or Collection name, put the name in square brackets `[ ]`

, like this:

`[User Stories].[Total Effort]`

#### Basic math operations

Nothing fancy here, usual operators are supported (`*, -, +, /`

)

`Effort * Risk / Complexity.Value`

Velocity - [Assigned Effort]

#### Access Collection and Fields

Use dot notation to access Collections and Fields:

`Epic.Estimate`

Epic.Product.Value * [Own Value]

#### Aggregates by collections

Calculate aggregates with one of these functions:

- Sum
- Avg
- Count
- Max
- Min

`Features.Count()`

Features.Sum(Estimate)

#### Filter inside collections

Use `Filter`

function (with `AND`

and `OR`

operators) to extract subsets from collections:

`Sum of Estimates of all not completed Features:`

Features.Filter(State.Final != true).Sum(Estimate)

`Count of all high complexity Features without Estimates: `

Features.Filter(Estimate = 0 AND Complexity.Name = "High").Count()