# Formula in report

**URL:** <https://community.silverfin.com/t/formula-in-report/2536>\
**Category:** Reports\
**Created:** [November 6, 2024, 8:18am UTC](https://community.silverfin.com/t/formula-in-report/2536 "2024-11-06T08:18:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Annelies](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@Annelies](https://community.silverfin.com/u/Annelies)\
**Post date:** [November 6, 2024, 8:18am UTC](https://community.silverfin.com/t/formula-in-report/2536/1 "2024-11-06T08:18:21Z")

</div>

Hello, I need to create a report that shows the total amount of an income statement if the total amount is positive. If the total is negative, then there may not appear a value and the value should be in another line.

---

<div class="post-metadata">

**Author:** ![Romy\_Vermeeren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/romy_vermeeren/32/2295_2.png) [@Romy\_Vermeeren](https://community.silverfin.com/u/Romy_Vermeeren)\
**Post date:** [November 7, 2024, 1:11pm UTC](https://community.silverfin.com/t/formula-in-report/2536/2 "2024-11-07T13:11:59Z")

</div>

Hi @Annelies and welcome to the Silverfin developer community!

Can you share the piece of liquid code you are struggling with?  
It would be a matter of creating two if-statements with the opposite conditions.  
{% if amount \< 0 %} … {% endif %} and {% if amount \>= 0 %} … {% endif %}  
One where you want to show the amount if negative, and another where you want to show the amount if it’s positive or zero.

Kind regards  
Romy

---

<div class="post-metadata">

**Author:** ![Annelies](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@Annelies](https://community.silverfin.com/u/Annelies)\
**Post date:** [November 7, 2024, 1:38pm UTC](https://community.silverfin.com/t/formula-in-report/2536/3 "2024-11-07T13:38:27Z")

</div>

Until today an excel was used to draw up a specific P&L reporting. If the amount is positive, it need to be shown in the line ‘postive result’ (otherwise 0) and if it is negative, in the line ‘negative result’ (otherwise 0). I used the type formule to build the line in the report but can’t add an if-formula.

---

<div class="post-metadata">

**Author:** ![Romy\_Vermeeren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.silverfin.com/romy_vermeeren/32/2295_2.png) [@Romy\_Vermeeren](https://community.silverfin.com/u/Romy_Vermeeren)\
**Post date:** [November 8, 2024, 8:29am UTC](https://community.silverfin.com/t/formula-in-report/2536/4 "2024-11-08T08:29:15Z")

</div>

Hi @Annelies

So if I understand correctly you are not building a template in liquid, but using the report functionality?  
I don’t think you can build conditions into those reports.  
[This article](https://silverfin.freshdesk.com/en/support/solutions/articles/101000394220-how-do-i-use-formulas-in-reports-) lists the possibilities for formulas in reports.

KR  
Romy

---

<div class="post-metadata">

**Author:** ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://community.silverfin.com/u/Peter)\
**Post date:** [November 8, 2024, 6:27pm UTC](https://community.silverfin.com/t/formula-in-report/2536/5 "2024-11-08T18:27:31Z")

</div>

Not sure if it will work, but try this:  
result \* (result \< 0)  
And  
result \* (result \> 0)

The part (result \< 0) or (result \> 0) will give True or False, but in calculations this changes in the value 0 or 1 wich you then multiply with the result

---

<div class="post-metadata">

**Author:** ![Annelies](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@Annelies](https://community.silverfin.com/u/Annelies)\
**Post date:** [November 14, 2024, 3:30pm UTC](https://community.silverfin.com/t/formula-in-report/2536/6 "2024-11-14T15:30:10Z")

</div>

The sign \> don’t work in the formula field in the reports.
