Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate StockInHand

Hi,

Can any one please help me, on "how to calculate Stock In Hand".

Below table is from excel.

dateStockINStockOUTStockINHLogicExplanation
01/01/151001585100 - 15 = 85
01/02/1510455085 + 10 - 45 = 50
01/03/151114050 + 1 - 11 = 40
01/04/1525353040 + 25 - 35 = 30
01/05/1520104030 + 20 - 10 = 40

How to get the values in "StockINH" using qlikview.

I'm using personal edition, please tell me the procedure to achieve.

Thanks In Advance.

Regards,

Pavan.

11 Replies
Not applicable
Author

Thanks Arul,

Thanks for your help.

mukesh24
Partner - Creator III
Partner - Creator III

Hi Pavan,

  Instead of calculating on front end, calculate it on backend ... Because performance increase if u calculate at backend.. U can do these as:-

FD:

LOAD * INLINE [

    date, StockIN, StockOUT

    01-01-2015, 100, 15

    01-02-2015, 10, 45

    01-03-2015, 1, 11

    01-04-2015, 25, 35

    01-05-2015, 20, 10

];

FDT:

load Year(date(date,'YYYYMMDD')) as Year,

     StockIN - StockOUT as InHand,

     *

Resident FD order by date;

FD1: load 

if(Year <> peek(Year),StockIN - StockOUT,peek(CB)+(InHand)) as CB,

  *

Resident FDT; 

drop table FD,FDT;    

Regards,

Mukesh Chaudhari