Item average cost price in ax 2009?

Hi all…

I’m new to AX.

Please help me to get the average cost price of an item.

I have calculated this by this code.

abs(Currency::price((InventTrans.CostAmountPosted + InventTrans.CostAmountAdjustment) / InventTrans.Qty,’’));

But this is wrong.

Can someone help me please?

Thanks.!