# Custom-Calculation

**URL:** <https://pug.phocassoftware.com/t/custom-calculation/1989>\
**Category:** Ask the Community\
**Tags:** howto\
**Created:** [September 28, 2021, 2:11pm UTC](https://pug.phocassoftware.com/t/custom-calculation/1989 "2021-09-28T14:11:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muskaan-Travers](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Muskaan-Travers](https://pug.phocassoftware.com/u/Muskaan-Travers)\
**Post date:** [September 28, 2021, 2:11pm UTC](https://pug.phocassoftware.com/t/custom-calculation/1989/1 "2021-09-28T14:11:53Z")

</div>

Hi All, I am trying to use a custom calculation for Profit. Trying to include the freight loss/gain in customer profit. Looks like when I am adding the freight loss/gain to the order processing cost even if its a loss it is adding that rather than subtracting! Is there a way around this? or I am doing something different?  
This is my custom calculation (B-((A\*20)+(C-D)))  
IF C-D is negative which is my freight charged- freight cost it would ideally subtract it right? (I am using brackets to make sure it follows BODMAS)

---

<div class="post-metadata">

**Author:** ![Mike](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Mike](https://pug.phocassoftware.com/u/Mike)\
**Post date:** [September 29, 2021, 7:26pm UTC](https://pug.phocassoftware.com/t/custom-calculation/1989/2 "2021-09-29T19:26:45Z")

</div>

Hi Muskaan-Travers,

Is your source data GL structured, as in the form of debits and credits? If it’s freight revenue and expense from your P&L, the signs are likely reversed. Freight charged (income) would reflect the reduction of the liability and therefore a negative number whereas freight cost (expense) would be an increase to the liability and would be a positive number. If true, that means you would be subtracting a positive number against a negative number. The two negatives cancel and the numbers would “add” (i.e. -5 - 5 = -10). If this is the case, simply change the (-) to a (+) or take each variable times -1 before you subtract. ((C\*-1)-(D\*-1))
