1. Help Center
2. Become a Pro
3. Working with Actuals

# How to work with basic and advanced functions in the custom metric builder

### Basic Functions

Functions are our way of automating more complex calculations than what you would calculate using basic operators or static numbers in the formula builder. There are essentially two types of functions in our growing library, Basic and Advanced. First, let's discuss Basic Functions:

• Basic Functions: these functions use metric values in their calculation. Examples of this would be Average, Gain/Loss, Median, Mode, Sum, Moving Average. You can learn more about these metrics and how they're calculated in the help center.

For example, Gain/Loss will calculate the difference between the current period value and the previous period value for any metric. This function is used throughout cash flow metrics in Malartu by taking the Gain/Loss of balance sheet items like Total Equity.

This is a basic function because it only takes into account the metric values. Advanced functions often take into account time in addition to metric values.

Advanced Functions often involve metric values and time as a factor. This means these functions will calculate differently depending on your display increment and display period.

A good example is DSO, which will calculate the number of Days Sales are Outstanding by dividing Accounts Receivable by Net Sales, then multiplying that factor by the number of days in your display period.

This means that if you calculate DSO and set your display period to "Last 90 days" the calculation will be

AR / Net Sales * 90

Similarly, if your display period was "Last Quarter," DSO will multiply AR/Net Sales by the number of days in that quarter.

Other functions like XIRR and NPV may include a start date. This means the amount of days elapsed from that start date will be incorporated in that calculation.

Including time as a factor in calculations can be an incredibly powerful tool, but it's important to remember that your display increment and period will affect the calculation.