QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Contributor

Closing Stock Amount Calculation

Hi all,

I have an issue in calculating closing stock amount.My requirement has been given in the attached application.Please follow the application and if you have any solution please share.I think it will calculated from the script end.

Koushik

Tags (2)
4 Replies
Valued Contributor

Re: Closing Stock Amount Calculation

Hello!

Try this:

FirstSortedValue({\$<[Reciept QTY]={'>0'}>} [Reciept QTY],-DATE)

/FirstSortedValue({\$<[Reciept QTY]={'>0'}>} [Reciept Amount],-DATE)

*sum({<DATE={'\$(=Max(DATE))'}>}[Closing Stock Qty])

And one note:

Best regards, Sergey

MVP

Re: Closing Stock Amount Calculation

Check attached qvw. Your calculated figure is wrong, it should be something like: 0.2054...

Contributor

Re: Closing Stock Amount Calculation

It is not working properly as per the requirement. pokassov‌'s solution is working properly as per my previous requirement but I am posting the updated logic with attached application.

For any RecID,ITEM,Warehouse,Color, DimID combination if last row have QTY_StockIn value with >0  then that row will be considered otherwise any other previous row on behalf of the last row where  the QTY_StockIn value is >0 then that QTY_StockIn value and its corresponding  AMT_StockIn value should be considered to calculate the m_AMT_StockCL. And also apply the logic using RecordId because it is unique.Do not depend on the date as it cant be in a sorted manner but recordid corresponding to that date will always be unique.

Ex:-  On belhalf of the attached Application,

as per the example

Inventory Closing Qty:1200

Here on the last record,

QTY_StockIn    = -1350

but we have to find in which last entry QTY_StockIn is >0,

So on the previous record, QTY_StockIn is 1350 then that record will be considered, but for that case we find >0 value for QTY_StockIN on last previous record and it is not static for all cases we can find anywhere the last >0 value QTY_StockIn, If Last record value have QTY_StockIn >0 then that record should be considered for taking IN QTY and Amount.

So The m_AMT_StockCL=

[

107211.53

/

1350

]

*1200(Inventory Closing Qty) =95299.14

I think implementing that logic inside script will be a great thing. Please check and if find any solution then share here.

Contributor