Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello , QlikView gurus!!
We are currently working on a Stock/Inventory document. One report they asked us to do on QlikView, is a report on the inicial stock of every month. The way to calculate the stock is to have the inicial inventory, plus add the entries to the warehouse, and sustract every product that is sold, transfered, etc.
Now, the calculation we are using is something like this:
sum({$<%Fecha = {"<$(=Min(%Fecha))"},Año, Mes,TipoOperacion, EntSal = {'Entrada'}>}IMOV_CANT)
-sum({$<%Fecha = {"<$(=Min(%Fecha))"},Año, Mes,TipoOperacion, EntSal = {'Salida'}>}IMOV_CANT)
The "<$(=Min($Fecha))" works calculating every single entry to the stock from the start, and sustracts every single exit from the stock, also from the start, for the minimal date (i.e. March/01/2013) for the selected month. Using this formula, we make sure that QV only takes the initial stock, and not the month movements, because that's the month final stock.
The thing is, we were asked to bring the inicial stock for every single month of the selected year, not only for the current selected month. Because we are using the "<$(=Min($Fecha))", we can't just only add our Month field from our master calendar to the table, we need to calculate independiently every single "inicial stock" for every single month, i.e.
Jan 2300
Feb 2500
Mar 4000
Apr 3300
And not only the "3300" for the last month, in this case, April.
We tried using GROUP BY on script, or using the Aggr(), but we were unsuccesful. Can you help me on this one
Thanks in advace!!!!!!!
Lo que puedes hacer es un ciclo for en el cual agrupes por mes - año, luego dentro de este calcular tus Entradas - Salidas!
Espero te sirva