# Rounding numbers

**URL:** <https://community.silverfin.com/t/rounding-numbers/506>\
**Category:** Templates\
**Tags:** variables, filters, filter\_number\
**Created:** [November 22, 2017, 3:28pm UTC](https://community.silverfin.com/t/rounding-numbers/506 "2017-11-22T15:28:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![marnixcoudre](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@marnixcoudre](https://community.silverfin.com/u/marnixcoudre)\
**Post date:** [November 22, 2017, 3:28pm UTC](https://community.silverfin.com/t/rounding-numbers/506/1 "2017-11-22T15:28:43Z")

</div>

Dear,

I would like to round my calculation to an integer (i.e. 0,6 turns into 1; 0,44 turns into 0).

I already tried the ceil and the round function but it does not seem to work.

Can somebody help me with this matter?

Kind regards,

Marnix

---

<div class="post-metadata">

**Author:** ![Thijs](https://avatars.discourse-cdn.com/v4/letter/t/a4c791/32.png) [@Thijs](https://community.silverfin.com/u/Thijs)\
**Post date:** [November 22, 2017, 3:33pm UTC](https://community.silverfin.com/t/rounding-numbers/506/2 "2017-11-22T15:33:19Z")

</div>

{% input custom.some.thing as:integer %}  
{{ custom.some.thing | integer }}

---

<div class="post-metadata">

**Author:** ![GMOONS](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@GMOONS](https://community.silverfin.com/u/GMOONS)\
**Post date:** [February 6, 2018, 1:19pm UTC](https://community.silverfin.com/t/rounding-numbers/506/3 "2018-02-06T13:19:08Z")

</div>

Dear Thijs,

I’m actually having a similar issue. However it is not solved by your solution.

I have for example the value 10.000,45, if I use the as:integer modus I get 10.000. However I would like to have 10000, so stripped from all “,” and “.”. Which function could I use than?

Kind regards

Glenn

---

<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:** [February 6, 2018, 2:11pm UTC](https://community.silverfin.com/t/rounding-numbers/506/4 "2018-02-06T14:11:01Z")

</div>

Hi Glenn

After using the integer, you can use the following liquid tag:

> {{ value | replace: ‘.’, ‘’ }}

This should give you the appropriate result.

Kind regards

Sam

---

<div class="post-metadata">

**Author:** ![GMOONS](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@GMOONS](https://community.silverfin.com/u/GMOONS)\
**Post date:** [February 6, 2018, 2:40pm UTC](https://community.silverfin.com/t/rounding-numbers/506/5 "2018-02-06T14:40:50Z")

</div>

Dear Sam,

Thanks for the answer, however it does not do quite the trick I was expecting.

Let me give you some background:  
In template 1 I’m inputting my variables:  
{% assign $1 = 0 %}  
{%=$1+ input custom.some.thing1 as:integer %}  
{%=$1+ input custom.some.thing2 as:integer %}  
{%=$1+ input custom.some.thing3 as:integer %}  
{% result ‘result1’ $1 %}

For example my input was: 10, 5 and 5.05

In my export file I used following code  
{{period.reconciliations.handlereconciliation.custom.some.thing1 |replace: “.” “”}}  
{{period.reconciliations.handlereconciliation.custom.some.thing2 |replace: “.” “”}}  
{{period.reconciliations.handlereconciliation.custom.some.thing3 |replace: “.” “”}}  
{{period.reconciliations.handlereconciliation.results.result1 | integer}}

This is my output:  
100  
50  
505  
20

What I should get is:  
10  
5  
5  
20

Could you help me out, please?

Kind regards,

Glenn

---

<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:** [February 6, 2018, 4:06pm UTC](https://community.silverfin.com/t/rounding-numbers/506/6 "2018-02-06T16:06:13Z")

</div>

Hi Glenn

This will solve it:

{% input custom.some.thing as:integer %}  
{{ custom.some.thing | **integer** | replace:"." **,**"" }}

Kind regards  
Sam

---

<div class="post-metadata">

**Author:** ![GMOONS](https://avatars.discourse-cdn.com/v4/letter/g/ce7236/32.png) [@GMOONS](https://community.silverfin.com/u/GMOONS)\
**Post date:** [February 6, 2018, 4:34pm UTC](https://community.silverfin.com/t/rounding-numbers/506/7 "2018-02-06T16:34:10Z")

</div>

Hi Sam,

This does indeed do the trick.

I had tried before {{custom.some.thing | integer replace:".",""}} However that gave me an error. I did not know it was necessar to use both times the |-function. Therefore I thought it was not possible.

Kind regards,

Glenn

---

<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:** [February 6, 2018, 6:57pm UTC](https://community.silverfin.com/t/rounding-numbers/506/8 "2018-02-06T18:57:34Z")

</div>

Indeed, Every filter needs its own pipe 🙂

Glad I could help and good luck with your templates.
