# Combining calculated fields

Hello,

I’m trying to combine 2 calculated fields into one in order to get a Net Available amount for each part.
I’ve created this calculated field called TotalQty…

Total(OrderRel1.OurReqQty - orderRel1.OurJobShippedQty - orderRel1.OurStockShippedQty)

…which gets incorporated into this calculated field, called Net Available.

if(PartWhse.OnHandQty - TotalQty)<0
then 0
else (PartWhse.OnHandQty - TotalQty)

Having both variables gives me the desired result, but I cannot have both calculated fields, only Net Available. Furthermore, I do need what TotalQty does, so I can sum quantities across multiple results and return one line per part instead of several lines. Is there a way to hide a calculated column, or combine these two formulas into one?

This seems like the obvious answer but it hasn’t worked for me:

if(PartWhse.OnHandQty - total(OrderRel1.OurReqQty - orderRel1.OurJobShippedQty - orderRel1.OurStockShippedQty)<0)
then 0
else (PartWhse.OnHandQty - total (OrderRel1.OurReqQty - orderRel1.OurJobShippedQty - orderRel1.OurStockShippedQty))