Microsoft Dynamics 365 Blog

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

We're always looking for feedback and would like to hear from you. Please head to the Dynamics 365 Community to start a discussion, ask questions, and tell us what you think!