1. Calculation functions
2. All Functions
3. Time and Date Functions Where two line items each have a different timescale, and one refers to the other in a formula, then days will aggregate into months, months aggregate into quarters, and quarters aggregate into years. You can choose to skip levels: days could aggregate directly into years if required. For more see Time Aggregation.

Remember! When you use any of the time functions, the value returned depends on the Summary Method set for the source line item.

## Functions and time ranges

All non-time series functions can read data from line items that use different time ranges or the Model Calendar. Time series functions must use the same time range for the line item holding the function, and any line items that provide arguments.

The time series functions are:

Time Series Functions
PREVIOUS NEXT PROFILE
POST MOVINGSUM DECUMULATE
LAG CUMULATE

### Behavior of time series functions

When you restrict a line item by applying a time range, you also restrict the periods from which a time series function can retrieve data. A time series function passes arguments that specify the value to return, and a point in a series of time periods to return it from. Some functions, such as MOVINGSUM, then perform an additional calculation on the returned value.

#### Assign a different time range to a result in a time series function

Anaplan prevents you entering a calculation that uses different time ranges for the line items that provide arguments and the result line item for any of the time series functions. If you enter a function that conflicts with this rule, it will be rejected.

Name Description
CUMULATE Cumulative sum from the first period of the timescale.
CURRENTPERIODEND The end date of the Current Period.
CURRENTPERIODSTART The start date of the Current Period.
DATE Converts numbers yyyy, mm, and dd to a date. Date format depends on your locale.
DAY Converts a date to a day in number format. Date format depends on your locale.
DAYS Number of days in a time period.
DAYSINMONTH Number of days in a specified calendar month.
DAYSINYEAR Number of days in a specified year where year is formatted as a four digit number, YYYY.
DECUMULATE Calculates the difference in a value between the result period and the previous period.
END Result is the last date in the period.
HALFYEARTODATE Takes a single numeric parameter and returns a cumulative sums across a Half-Year time range and then resets.
HALFYEARVALUE Returns the Half-Year value of the source line item, according to the Time Summary method set for the source.
INPERIOD Tests whether a date falls within the period specified on the time dimension or falls within a time period (result is Boolean-formatted).
LAG Take the value from n periods in the past. If this is before the start of the timescale, use z instead as the fill value.
LEAD Take the value from n periods in the future. If this is beyond the end of the timescale, use z instead as the fill value.
MONTH Converts a date or a time period to a calendar month as number.
MONTHTODATE Takes a single numeric parameter and returns a cumulative sums across a month time range and then resets.
MONTHVALUE Returns the month value of the source line item, according to the Time Summary method set for the source.
MOVINGSUM Calculates moving values, such as a moving sum or moving average.
NEXT Returns a value from the next period.
OFFSET Returns a value from a specified number of periods in advance.
PERIOD Take a date as parameter and returns a time period as result.
POST Post a value to a specified number of periods in the future.
PREVIOUS Takes a value from the previous period.
PROFILE Allocates a value over the next few periods based on a table containing % current period, % next period, % pd+2 etc.
QUARTERTODATE Takes a single numeric parameter and returns a cumulative sums across a quarter time range and then resets.
QUARTERVALUE Returns the Quarter value of the source line item, according to the Time Summary method set for the source.