Disaggregating a series
Intro
In this exercise, we’ll use a formula to disaggregate a series. Normally, you can do this with a simple rate of change, but sometimes you’ll want to use a formula to specify some additional conditions.
In this case, we want to disaggregate the series cntrad1290 (China Current Prices, Total, Aggregate, CNY). This is Chinese data that is aggregated on a yearly basis and does not have values for January. Therefore, we’ll need to disaggregate only the values from March to December and split the February value between January and February.

Step 1 (expandable paragraph)
Step 2 (expandable paragraph)
Step 3 (expandable paragraph)
Step 4 (expandable paragraph)
Summary (expandable paragraph)
To the see exact construction of the document, you can download the file here.
To learn more about Formulas in Macrobond have a look at these articles: Formula.
The Disaggregate formula enables you to disaggregate a time series while also specifying conditions so that the calculation will take the series' unique properties into account.
Value 2 is what you want to return when the condition is false. In this case, our condition is false when the month is January or February. In this case, we want to return the February value divided by 2. That way we are distributing the February value between January and February. That expression is simply
cntrad1290/2
Your final formula should look like this:
If(month()>2, momentum(cntrad1290, 1), cntrad1290/2)
To see full effect please set 'Observations' to 'All points' and 'Conversion settings' to 'Next value':

Value 1 is what you want to do when the condition is true. In our case, we want to disaggregate the data. Calculating the difference between a value and a previous value of a series can be achieved with the formula:
momentum(series, length)
where length is the observation window between the value and the previous value. Here, you want to subtract the value of the previous month, so the length is 1.
If(month()>2, momentum(cntrad1290, 1), value 2)
The month of the year will determine what operation should be done to get the disaggregated value of the series, so we want the condition to be true if the month is between March and December. The shortest way to write this in Macrobond is as follows:
month()>2
This statement checks if the month’s value is greater than 2, meaning that it’s after February.
So far, our formula looks like this:
if(month()>2, value 1, value2)
We want to perform two different actions depending on the month of the year. For this reason, we need to use the following formula:
if(condition, value 1, value2)
This formula will check if the written condition is true or false and create a new series with value 1 when the condition is true, and value 2 when the condition is false.
Joining two series
Intro
One transformation you can achieve with formula language is to combine two series, creating one longer series. This is useful when you work with historical data that you want to add to a current series. In this tutorial, you will see how to use the ‘Join’ formula and its variations.

In this example, we have two Indian GDP series (innaac1015 and innaac0109), one that ends in 2014 and another that starts in 2011. Our aim is to combine these series. The solution is to use the ‘Join’ formula. This formula has a few different variations depending on what we want the resulting series to be.
Case 1 (expandable paragraph)
Case 2 (expandable paragraph)
Case 3 (expandable paragraph)
Summary
The Join formula with all its variations is a powerful tool for series transformation. The key is to get familiar with them so that you will be able to use the desired one for each case.
To learn more about Formulas in Macrobond have a look at these articles: Formula.
You have probably noticed that the series we’re working with have different scales so simply combining them will not always give the result we were looking for. To have a more smooth junction we need to use one of the following formulas: JoinScaled(series1, series2) or JoinMoreHistoryScaled(series1, series2). These two versions correspond to cases 1 and 2, respectively.
Here, we’ve used JoinMoreHistoryScaled(series1, series2), so series2 is scaled so that its value at the date of junction is equal to the value of series1.
Here’s the result:

To the see exact construction of the document, you can download the file here.
Another option when it comes to combining series is the formula JoinMoreHistory(series1, series2).
This function will complement series1 with the values of series2 that are before the start of series1. You would typically use this function when you need to add history to a series.
Here’s how it will look:

To the see exact construction of the document, you can download the file here.
Let’s start with the standard version: Join(series1, series2).
This function will join 'series1' and 'series2', in our case innaac1015 and innaac0109. The junction will be done at the end of series1.
Here’s how it will look on a chart:

To the see exact construction of the document, you can download the file here.