We run lately in the issue when COGS value is not correct calculated for Sales Cube.
The problem occurs, when in Microsoft Dynamics AX are some return deliveries. For example 1 article will be returned as a negative position with a negative amount. The COGS field turns the negative amount into a positive (-4.000 $ -> +4.000 $).
That problem is in named query CustInvoiceTrans where we have following statement:
The correct statement should look in following way: