Returning 0 if value is NULL
my intention is to return 0 if ig.NumReceived or og.NumShipped return 0 as well


If so, convert

coalesce((p.StartingInventory-og.NumShipped+ig.NumReceived), p.StartingInventory) as OnHand


to, for example,

coalesce(  p.StartingInventory - og.NumShipped + ig.NumReceived,
           case when ig.NumReceived = 0 or og.NumShipped = 0 
                then 0 
                else p.StartingInventory 
                end               
        ) as OnHand