Calculation fields are very powerful feature that you can use to add an additional layer of intelligence to your Membrain experience. They are available on the Membrain Excellence Tier and can be used right across the board on Sales Projects, Prospects, Companies & Contacts.

They work with Number and Date properties, as well as ScoreCard results and can really give you lots of additional information by bringing data from different fields and presenting it as fresh information in a custom field. The great thing about calculation fields is that they are so flexible, and once you get started, they are quite easy to use.

# How Calculation Fields Work

- The end result of a Calculation Field is a number, presented in a Custom Field. So the first thing you need to do is create the Custom Field which will display your calculated information, where you want it to be related to what information you want to use.
- From the process editor, or Custom Field management area in System setup, create a new calculation Custom Field.
- Use the Insert Property button to build your calculation. In this article we will prefix any such variable with @, example: @Value to make it clear that a variable is referenced.

# Some Examples

**Subtract amounts in one custom field from another.**

In this example, Amount 1 and Amount 2 are predefined custom fields. We want to see Amount 1 minus Amount 2 in the new calculation field. This is achieved with the following setup:**Calculate profit margin**

((@Value - @OurCosts) / @Value) * 100

**Average the value of multiple scorecards**

Average(@FirstScoreCard, @SecondScoreCard, @ThirdScoreCard)**Calculate revenue this fiscal year**

MonthsBetween(@ClosingDate, '2017-04-31') * @MonthlyValue

# Considerations

## Value Types

- Calculation fields works with two types of values: Numbers and Dates.
- Dates can only be used as input to certain functions.
- Numbers are given either as 123, or 1.23. Dates are given as '2016-12-31'.

## Operators

Calculation fields support the following operators: +, -, * and /.

## Functions

- Min

Min takes any number of arguments, either a number, or a referenced numerical property and returns the smallest of those numbers. Example: Min(1,5,3) = 1 - Max

Max takes any number of arguments, either a number, or a referenced numerical property and returns the largest of those numbers. Example: Max(1,5,3) = 5 - Sum

Sum takes any number of arguments, either a number, or a referenced numerical property and returns the sum of those numbers. Example: Sum(1,5,3) = 9. Sum is thus exactly the same as 1+5+3. - Average

Average takes any number of arguments, either a number, or a referenced numerical property and returns the average of those numbers. Example: Sum(1,5,3) = 3. - Round

Rounds a number either up or down depending on its value. Example: Round(0.3) = 0. Round(0.6) = 1 - Floor

Rounds a number down. Example: Floor(0.9) = 0. Floor(0.1) = 0 - Ceil

Rounds a number up: Example: Ceil(0.1) =1. Ceil(0.8) = 1 - DaysBetween

Takes two dates and returns the number of days between those dates. Example DaysBetween('2016-01-01', '2016-02-01') = 31 - MonthsBetween

Takes two dates and returns the number of months between those dates. Example MonthsBetween('2016-01-20', '2016-04-12') = 3 - Years Between

Takes two dates and returns the number of months between those dates. Example Years Between('2016-01-20', '2018-02-12') = 2