Your formula works.
However , if i use the heading names in the stock required , the formula does not work. (see model attached).
Can you tell me why?
I change the names of the headings of the 3 columns :
ie Average = NewAVG
Stock on Hand = NewSOH
Sales Order = NewSO
In my actual buying temple, each of the columns is a complex if formula, hence i use the name of the headings in my stock required formla.
You can look into the method
Sum of rows in pivot tables using adavanced aggregation
in the Help.
This will look like
if(Average*7-[Stock on Hand]+[Sales Order]<0,0,Average*7-[Stock on Hand]+[Sales Order])
,[Component Code],[ITEM CODE]))
for your expression.
Probably there is even an easier solution.