Carry forward amount that is not from an input

I have a table that calculates Negative net interest - Deduction current year’s interest. The answer is sent to another table (Total interest carry forward…).
The problem I have is that I want the answer from the previous year to populate that year’s row in the current year’s table.
I have only used carry forward with input data, and I do not know how to carry forward an amount that is not used in an input. Anyone have a solution to this?

Kind regards,

Hi Anna,

You could accomplish it using rollforwards and different custom drops that are related to each period. The exact approach will depend on how your code is structured but here is simple example to start with:

{% assign year_from = period.year_end_date | date:"%Y" %}
{% rollforward total_interest custom.year.[year_from] %}

Later on, you can display them simple as:

2019: {{ custom.year.2019 }}
2020: {{ custom.year.2020 }}

Notice that you can include variables in a rollforward. The origin of this copy details can be a variable, the destination (which is the second element in the rollforward tag) is the one that cannot be a variable and it always has to be a custom drop. In this case, total_interest could be replaced with the variable where you have your total accumulated.
Also, year_from will represent the period in which you are copying data from, and you can use it to create one custom drop related to each period.
Like it is show at the end, you don’t really need to display this custom drops as input fields, you could simple ‘print’ it’s value with {{ }}.

You could also add some extra conditions around the copy details logic. For example, we usually use a condition like this, where we establish that you can only copy details into a future period and not the other way around.

{% assign year_from = period.year_end_date %}
{% assign year_to = rollforward.period.year_end_date %}

{% if year_to > year_from %}
  {% capture previous_year %}{{ year_from | date:"%Y"}}{% endcapture %}
  {% rollforward total_interest custom.year.[previous_year] %}
{% endif %}

Thank you so much, this worked great!