# Overview

The* Aggregate* analysis transforms a time series so that the values are summed either periodically (each year for instance) or continuously, starting from a specified date. Aggregate is useful when you are working with 'flow' series.

# Settings

In this analysis, you can define the following settings to determine how the calculation is done:

## Period

The window of the calculation is set by the period you choose. If you select 'All' a continuous sum will be performed and you can set a date at which the sum should start.

## Percentage

Selecting this option will express the result as a percentage, so it will calculate the sum and divide by 100.

## Rolling

If you’ve chosen a period other than 'All', you can select 'rolling' to perform the sum on a rolling basis. The window of the rolling sum is the same as the period you have chosen.

# Examples

In this example, the aggregate analysis is used to calculate an annual rolling sum of the German current account. In other words, the sum is performed on a rolling window of 1 year.

How to calculate fiscal year rolling aggregate on a series from country which doesn't report it like calendar year?

# Questions

- How do I calculate a rolling sum?
- How to keep series as is and start aggregating it from certain point in time?

## How do I calculate a rolling sum?

There are two main possibilities to calculate a rolling sum:

**The Aggregate analysis:**

Set the 'Period' to the desired rolling length, and to not forget to tick the setting 'Rolling'.

**Formula:**

You can also use the formula

sum(series, window)

#### Example:

sum(usflof8344, YearsLength(2))

This will calculate a 2-years rolling sum on 'usflof8344'.

For more about formulas and how formula language in Macrobond works see Formula analysis.

## How to keep series as is and start aggregating it from certain point in time?

Use formula (on Series list or in Formula analysis):

AggregateSum(CutStart(series, Date(YYYY, MM, DD)))

in

join(older_series, newer_series, Start(newer_series))

CutStart() will create series from fragment you wish to aggregate. AggregateSum() will cumulate values. Then you need to connect that cumulated fragment with regular series using join(). As in below example:

join(sek, AggregateSum(CutStart(sek, Date(2024, 4, 2))), Start(AggregateSum(CutStart(sek, Date(2024, 4, 2)))))