# Urgent: rounding differences

**URL:** <https://community.silverfin.com/t/urgent-rounding-differences/305>\
**Category:** Templates\
**Tags:** variables, math\
**Created:** [June 13, 2017, 10:12am UTC](https://community.silverfin.com/t/urgent-rounding-differences/305 "2017-06-13T10:12:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fiduciaire.Eulaers](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/fiduciaire.eulaers/32/31_2.png) [@Fiduciaire.Eulaers](https://community.silverfin.com/u/Fiduciaire.Eulaers)\
**Post date:** [June 13, 2017, 10:12am UTC](https://community.silverfin.com/t/urgent-rounding-differences/305/1 "2017-06-13T10:12:38Z")

</div>

The topic about the rounding differences is closed, so I opened a new one.  
This is the code to get rid of the rouding differences, but now we have another problem with the “verworpen uitgaven”.

The code:

```auto
{% capture table %}
{% if custom.detail.accounts == blank %}{% assign account_range = '61' %}{% else %}{% assign account_range = custom.detail.accounts %}{% endif %}

| **VERWORPEN UITGAVEN** {% input custom.detail.accounts as:account_collection range:6,7 default:account_range %} | Totaal rekening | Aftrekbeperking | Verworpen {% assign accounts = period.accounts | range:account_range %}
|-----------40%---------------|---------------15%-----------:|---------------25%-----------:|---------------15%-----------:+{% for account in accounts %}
|{% if forloop.last %}_{% endif %}{{ account.name }}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{%=$0+ 1*account.value %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% input custom[account.number].aftrekbeperking as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if custom[account.number].aftrekbeperking == blank %}{% assign aftrekbeperking = 1 %}{% else %}{% assign aftrekbeperking = custom[account.number].aftrekbeperking %}{% endif %}{%=$1+ 1*aftrekbeperking*account.value | round | currency %}{% if forloop.last %}_{% endif %}{% endfor %}

{% ifi custom.verklaringen != empty %}
|-----------40%---------------|---------------15%-----------:|---------------25%-----------:|---------------15%-----------:+{%fori explanation in custom.verklaringen %}
|_{% input explanation.description %}_|_{% $2+input explanation.value as:currency %}_|{% if forloop.last %}_{% endif %}{% input explanation.verworpen as:percentage %}{% if forloop.last %}_{% endif %}|{% if forloop.last %}_{% endif %}{% if explanation.verworpen == blank %}{% assign verworpen = 0 %}{% else %}{% assign verworpen = explanation.verworpen %}{% endif %}{%=$1+ 1*explanation.value*explanation.verworpen | round | currency %}{% if forloop.last %}_{% endif %}{%endfori %}
{% endifi %}

|----------40%----------|------------15%------:|-----------25%-------:|---------------15%-----------:+
| | {{ $0 | round | currency }} | | **{{ $1 | round | currency }}{% result 'te_verwerpen1' $1 %}**
{% endcapture %}

{% if custom.detail.goederen == blank %}{% assign goederen_range = ''%}{% else %}{% assign goederen_range = custom.detail.goederen %}{% endif %}
{% assign goederen = period.accounts | range:goederen_range %}

{{ table }}

```

The result:

 ![](https://canada1.discourse-cdn.com/flex030/uploads/getsilverfin/original/1X/11b7df0e8a992bfae956788c5277f455c3b4abd3.jpg)

Normally, the result was 0,00 when we had no “Verworpen uitgaven”.

How do we need to solve this? This should be fixed tomorrow, because I’m going on a holiday…  
When we do have “Verworpen uitgaven”, there is no problem.

---

<div class="post-metadata">

**Author:** ![sven](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/sven/32/1495_2.png) [@sven](https://community.silverfin.com/u/sven)\
**Post date:** [June 13, 2017, 12:19pm UTC](https://community.silverfin.com/t/urgent-rounding-differences/305/2 "2017-06-13T12:19:03Z")

</div>

Hello @Fiduciaire.Eulaers,

Not a problem to create a new topic; I prefer that for each (new) problem.

Because it’s urgent, I can give you a quick workaround but couldn’t find the reason (has something to do by converting zero value to a string, but it doesn’t make sense for now to me).

If you work with following if-statement behind the totals, you should be fine :

```auto
{% if accounts != empty %}
|----------40%----------|------------15%------:|-----------25%-------:|---------------15%-----------:+
| | {{ $0 | round | currency }} | | **{{ $1 | round | currency }}{% result 'te_verwerpen1' $1 %}** {% endif %}

```

Does that work for you?

So, what you do here, is that the totals only will be displayed and/or executed if you have accounts selected.

---

<div class="post-metadata">

**Author:** ![Fiduciaire.Eulaers](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/fiduciaire.eulaers/32/31_2.png) [@Fiduciaire.Eulaers](https://community.silverfin.com/u/Fiduciaire.Eulaers)\
**Post date:** [June 13, 2017, 12:24pm UTC](https://community.silverfin.com/t/urgent-rounding-differences/305/3 "2017-06-13T12:24:27Z")

</div>

This works, thanks for your quick respons!

For the future, we would like the 0,00 to be shown, but it’s less urgent.
