# How to sum up totals in P&L forecast

**URL:** <https://community.silverfin.com/t/how-to-sum-up-totals-in-p-l-forecast/1032>\
**Category:** Templates\
**Tags:** variables, math, iterations, for\_loop\
**Created:** [July 2, 2018, 8:08am UTC](https://community.silverfin.com/t/how-to-sum-up-totals-in-p-l-forecast/1032 "2018-07-02T08:08:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![NickS](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@NickS](https://community.silverfin.com/u/NickS)\
**Post date:** [July 2, 2018, 8:08am UTC](https://community.silverfin.com/t/how-to-sum-up-totals-in-p-l-forecast/1032/1 "2018-07-02T08:08:10Z")

</div>

Hi Sam,

I want to add the following totals in the P & L forecast. Do you know a way I can do that?

- Operating income = Other operating rev + Change in work + Change in inventory.
- Gross margin = (Net revenue + Operating income) - (Cost of sales + Cost of outsourced work + Other purchase).
- Operating profit (EBITDA) = Gross margin - (Wages+ social + Pension + other staff + Accomodation cost + Sales costs + transport costs + Other operating).
- EBIT = EBITDA - depreciation of tangible and intangible assets).
- Result before taxation = EBIT + (Interest income - interest expenses) + (exeptional income - exeptional expenses) + (revenues + changes in value).
- Result after taxation = Result before taxation - (corporate taxes + income taxes - result participations).
- Net profit = Result after taxation.
- Adding to reserves = Net profit - Dividend

* * *

{% assign growth\_perc = 1.02 %}

{% assign revenue = period.accounts | range:“70” %}  
{% assign net\_revenue = period.accounts | range: “70” %}  
{% assign other\_operating\_revenues = period.accounts | range:“74” %}  
{% assign change\_in\_work = period.accounts | range:“0” %}  
{% assign change\_in\_inventory\_finished\_goods = period.accounts | range:“0” %}

{% assign cost\_of\_sales = period.accounts | range:“0” %}  
{% assign cost\_of\_outsourced\_work = period.accounts | range:“0” %}  
{% assign other\_purchase = period.accounts | range:“0” %}

{% assign wages\_and\_salaries = period.accounts | range:“455” %}  
{% assign social\_security\_costs = period.accounts | range:“0” %}  
{% assign pension\_costs = period.accounts | range:“0” %}  
{% assign other\_staff\_costs = period.accounts | range:“0” %}  
{% assign accommodation\_costs = period.accounts | range:“0” %}  
{% assign sales\_costs = period.accounts | range:“0” %}  
{% assign transport\_costs = period.accounts | range:“0” %}  
{% assign other\_operating\_expenses = period.accounts | range:“61” %}

{% assign depreciation\_of\_assets = period.accounts | range:“63” %}

{% assign interest\_income = period.accounts | range:‘7513’ %}  
{% assign interest\_expenses = period.accounts | range:“7513” %}  
{% assign extraordinary\_income = period.accounts | range:“76” %}  
{% assign extraordinary\_expenses = period.accounts | range:“65” %}  
{% assign other\_revenues = period.accounts | range:“7510” %}  
{% assign changes\_in\_value = period.accounts | range:“0” %}

{% assign corporate\_taxes = period.accounts | range:“67” %}  
{% assign income\_tax = period.accounts | range:“0” %}

{% assign result\_participations = period.accounts | range:“0” %}

{% assign dividend = period.accounts | range:“0” %}

{% assign start\_date = period.year\_start\_date | date:"%Y" %}  
{% assign end\_date = period.year\_end\_date | date:"%Y" %}

{::infotext as=“hover”}  
By choosing a previous year you can make a valuation with three to five future forecast years at your own discretion  
{:/infotext}

| Description |{% if start\_date == end\_date %}{{ start\_date }}{% else %}{{start\_date}} - {{end\_date}}{% endif %}{% for i in (1…5) %} | {{ INT(start\_date+i) }}{% endfor %}  
|------------|----------|----------{% for i in (0…4) %}|----------{% endfor %}+  
|Revenue |{{ -1_revenue | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_revenue | currency }} {% assign revenue = growth\_perc_revenue %} {% endfor %}  
| **Net revenue** |  
|Other operating revenues |{{ -1_other\_operating\_revenues | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_other\_operating\_revenues | currency }} {% assign other\_operating\_revenues = growth\_perc_other\_operating\_revenues %} {% endfor %}  
|Change in work in progress |{{ -1_change\_in\_work | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_change\_in\_work | currency }} {% assign change\_in\_work = growth\_perc_change\_in\_work %} {% endfor %}  
|Change in inventory of finished goods |{{ -1_change\_in\_inventory\_finished\_goods | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_change\_in\_inventory\_finished\_goods | currency }} {% assign change\_in\_inventory\_finished\_goods = growth\_perc_change\_in\_inventory\_finished\_goods %} {% endfor %}  
| **Operating income** |  
|Cost of sales |{{ -1_cost\_of\_sales | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_cost\_of\_sales | currency }} {% assign cost\_of\_sales = growth\_perc_cost\_of\_sales %} {% endfor %}  
|Cost of outsourced work |{{ -1_cost\_of\_outsourced\_work | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_cost\_of\_outsourced\_work | currency }} {% assign cost\_of\_outsourced\_work = growth\_perc_cost\_of\_outsourced\_work %} {% endfor %}  
|Other purchase |{{ -1_other\_purchase | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_other\_purchase | currency }} {% assign other\_purchase = growth\_perc_other\_purchase %} {% endfor %}  
| **Gross margin** |  
|Wages and Salaries |{{ -1_wages\_and\_salaries | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_wages\_and\_salaries | currency }} {% assign wages\_and\_salaries = growth\_perc_wages\_and\_salaries %} {% endfor %}  
|Social security costs |{{ -1_social\_security\_costs | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_social\_security\_costs | currency }} {% assign social\_security\_costs = growth\_perc_social\_security\_costs %} {% endfor %}  
|Pension costs |{{ -1_pension\_costs | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_pension\_costs | currency }} {% assign pension\_costs = growth\_perc_pension\_costs %} {% endfor %}  
|Other staff costs |{{ -1_other\_staff\_costs | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_other\_staff\_costs | currency }} {% assign other\_staff\_costs = growth\_perc_other\_staff\_costs %} {% endfor %}  
|Accommodation costs |{{ -1_accommodation\_costs | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_accommodation\_costs | currency }} {% assign accommodation\_costs = growth\_perc_accommodation\_costs %} {% endfor %}  
|Sales costs |{{ -1_sales\_costs | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_sales\_costs | currency }} {% assign sales\_costs = growth\_perc_sales\_costs %} {% endfor %}  
|Transport costs |{{ -1_transport\_costs | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_transport\_costs | currency }} {% assign transport\_costs = growth\_perc_transport\_costs %} {% endfor %}  
|Other operating expenses |{{ -1_other\_operating\_expenses | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_other\_operating\_expenses | currency }} {% assign other\_operating\_expenses = growth\_perc_other\_operating\_expenses %} {% endfor %}  
|**Operating profit (EBITDA)** |  
|Depreciation of assets |{{ -1_depreciation\_of\_assets | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_depreciation\_of\_assets | currency }} {% assign depreciation\_of\_assets = growth\_perc_depreciation\_of\_assets %} {% endfor %}  
|**Operating profit (EBIT)** |  
|Interest income |{{ -1_interest\_income | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_interest\_income | currency }} {% assign interest\_income = growth\_perc_interest\_income %} {% endfor %}  
|Interest expenses |{{ -1_interest\_expenses | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_interest\_expenses | currency }} {% assign interest\_expenses = growth\_perc_interest\_expenses %} {% endfor %}  
|Extraordinary income |{{ -1_extraordinary\_income | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_extraordinary\_income | currency }} {% assign extraordinary\_income = growth\_perc_extraordinary\_income %} {% endfor %}  
|Extraordinary expenses |{{ -1_extraordinary\_expenses | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_extraordinary\_expenses | currency }} {% assign extraordinary\_expenses = growth\_perc_extraordinary\_expenses %} {% endfor %}  
|Other revenues |{{ -1_other\_revenues | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_other\_revenues | currency }} {% assign other\_revenues = growth\_perc_other\_revenues %} {% endfor %}  
|Changes in value |{{ -1_changes\_in\_value | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_changes\_in\_value | currency }} {% assign changes\_in\_value = growth\_perc_changes\_in\_value %} {% endfor %}  
| **Result before taxation** |  
|Corporate taxes |{{ -1_corporate\_taxes | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_corporate\_taxes | currency }} {% assign corporate\_taxes = growth\_perc_corporate\_taxes %} {% endfor %}  
|Income tax |{{ -1_income\_tax | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_income\_tax | currency }} {% assign income\_tax = growth\_perc_income\_tax %} {% endfor %}  
|Result participations |{{ -1_result\_participations | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_result\_participations | currency }} {% assign result\_participations = growth\_perc_result\_participations %} {% endfor %}  
| **Result after taxation** |  
| **Net profit** |  
|Dividend (shareholders financing) |{{ -1_dividend = period.accounts | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_dividend = period.accounts | currency }} {% assign dividend = period.accounts = growth\_perc_dividend = period.accounts %} {% endfor %}  
| **Adding to reserves** |

 ![P%26L%20prinstscreen](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/86beb046b8357f0778c4079602957025fe0670f5.png)

---

<div class="post-metadata">

**Author:** ![SamVanEenoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/samvaneenoo/32/134_2.png) [@SamVanEenoo](https://community.silverfin.com/u/SamVanEenoo)\
**Post date:** [July 2, 2018, 8:22am UTC](https://community.silverfin.com/t/how-to-sum-up-totals-in-p-l-forecast/1032/2 "2018-07-02T08:22:22Z")

</div>

Dag Nick

Dit eenvoudig voorbeeld zou je verder moeten helpen:

{% assign revenue = 1000 %}  
{% assign rev\_perc = 1.2 %}

> ```
> {% assign cost = 600 %}
> {% assign cost_perc = 1.15 %}
> 
> {% for i in (1..4) %}
> {% assign revenue = revenue*rev_perc %}
> {% capture profit_var %}profit_{{i}}{% endcapture %}
> {% assign [profit_var] = revenue %}
> {% endfor %}
> 
> {% for i in (1..4) %}
> {% assign cost = cost*cost_perc %}
> {% capture profit_var %}cost_{{i}}{% endcapture %}
> {% assign [profit_var] = [profit_var]-cost %}
> {% endfor %}
> 
> {% for i in (1..4) %}
> {% capture profit_var %}cost_{{i}}{% endcapture %}
> {{ [profit_var] }}
> {% endfor %}
> 
> ```

Met vriendelijke groeten  
Sam

---

<div class="post-metadata">

**Author:** ![NickS](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@NickS](https://community.silverfin.com/u/NickS)\
**Post date:** [July 2, 2018, 2:10pm UTC](https://community.silverfin.com/t/how-to-sum-up-totals-in-p-l-forecast/1032/3 "2018-07-02T14:10:34Z")

</div>

Hi Sam,

Thanks.

For some reason I am unable to add up the amounts.  
On the line ‘Operating income’ I want to have the totals of these 3 items per year:  
other\_operating\_revenues  
change\_in\_work  
change\_in\_inventory\_finished\_goods

Would you please write the code for this (total per year Operating income) then I can probably do the rest myselves.  
Thank you.

* * *

{% assign growth\_perc = 1.02 %}

{% assign other\_operating\_revenues = period.accounts | range:“74” %}  
{% assign change\_in\_work = period.accounts | range:“0” %}  
{% assign change\_in\_inventory\_finished\_goods = period.accounts | range:“0” %}

{% assign start\_date = period.year\_start\_date | date:"%Y" %}  
{% assign end\_date = period.year\_end\_date | date:"%Y" %}

| Description |{% if start\_date == end\_date %}{{ start\_date }}{% else %}{{start\_date}} - {{end\_date}}{% endif %}{% for i in (1…5) %} | {{ INT(start\_date+i) }}{% endfor %}  
|------------|----------|----------{% for i in (0…4) %}|----------{% endfor %}+  
|Other operating revenues |{{ -1_other\_operating\_revenues | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_other\_operating\_revenues | currency }} {% assign other\_operating\_revenues = growth\_perc_other\_operating\_revenues %} {% endfor %}  
|Change in work in progress |{{ -1_change\_in\_work | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_change\_in\_work | currency }} {% assign change\_in\_work = growth\_perc_change\_in\_work %} {% endfor %}  
|Change in inventory of finished goods |{{ -1_change\_in\_inventory\_finished\_goods | currency }} {% for i in (0…4) %}| {{ -1_growth\_perc_change\_in\_inventory\_finished\_goods | currency }} {% assign change\_in\_inventory\_finished\_goods = growth\_perc_change\_in\_inventory\_finished\_goods %} {% endfor %}  
| **Operating income** |

 ![Total%20operating%20income%20printscreen](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/b7b8ad274756d3d4947e059212057882c9656571.png)

---

<div class="post-metadata">

**Author:** ![NickS](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@NickS](https://community.silverfin.com/u/NickS)\
**Post date:** [July 2, 2018, 2:24pm UTC](https://community.silverfin.com/t/how-to-sum-up-totals-in-p-l-forecast/1032/4 "2018-07-02T14:24:27Z")

</div>

We’ve tried something for a while and now it works.  
Thank you very much. 😃

---

<div class="post-metadata">

**Author:** ![NickS](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@NickS](https://community.silverfin.com/u/NickS)\
**Post date:** [July 2, 2018, 2:46pm UTC](https://community.silverfin.com/t/how-to-sum-up-totals-in-p-l-forecast/1032/5 "2018-07-02T14:46:22Z")

</div>

After trying different things, we succeeded.  
Thank you.

---

<div class="post-metadata">

**Author:** ![SamVanEenoo](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/samvaneenoo/32/134_2.png) [@SamVanEenoo](https://community.silverfin.com/u/SamVanEenoo)\
**Post date:** [September 7, 2018, 7:33am UTC](https://community.silverfin.com/t/how-to-sum-up-totals-in-p-l-forecast/1032/6 "2018-09-07T07:33:11Z")

</div>

Sorry for the late reaction.

Glad you found something yourself!

Kind regards  
Sam
