Hi all, I need to calculate the current stock, but always taking into account the origin. I mean that, when you select a year or a month, the stock calculates it from year 0, and not only from the selected period. In order to be able to assemble a stock chart, with X axis with the variable date or year, or month, etc ...
LOAD
WERKS as Centro,
LGORT as Almacen,
REPLACE(LTRIM(REPLACE(MATNR, '0', ' ')), ' ', '0') AS Material_ID,
SHKZG as Debe_haber, //(if the field is Debit, the quantity is negative and if it is Credit, the quantity is positive), but the table always shows the amount in Positive.//
BUDAT_MKPF as fecha_cont,
year(BUDAT_MKPF) as Año, Month (BUDAT_MKPF) as Mes, week (BUDAT_MKPF) as Semana,
MENGE as Cantidad
FROM [lib://Table.Data (gbenito)/MSEG.QVD] (qvd);
And the fied Stock is calculates as a Master Metric: Sum(If([Debe_haber] = 'S', 1, -1) * Cantidad)