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:

(SELECT ABS(SUM(COSTAMOUNTPOSTED)+SUM(COSTAMOUNTADJUSTMENT)) AS COGS

The correct statement should look in following way:

(SELECT -(SUM(COSTAMOUNTPOSTED)+SUM(COSTAMOUNTADJUSTMENT)) AS COGS

 

image

--author: Damien Maspero
--editor: Czesława Langowska
--date:

7/July/2011