Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
deepakk
Partner - Specialist III
Partner - Specialist III

How to get The Closing Stock For a Month....

Hi All,

I have Application where I am Calculating the stokc per day at the back end. For Eg

Data:

DateProdQty
1-Jan-09A10
2-Jan-09A30
3-Jan-09A40
4-Jan-09A-10
5-Jan-09A-10
6-Feb-09A-10
7-Feb-09A30


Calculating Stock per Date at Script Level.

DateProdQty1
1-Jan-09A10
2-Jan-09A40
3-Jan-09A80
4-Jan-09A70
5-Jan-09A60
6-Feb-09A50
7-Feb-09A80


NOw I want to Display Closing stoock for each month

Output required :

Prod

ProdMonthQty
AJan60
AFeb80


Please let me know if you all require any other information.

Thanks & Regards

Deepak

1 Solution

Accepted Solutions
prieper
Master II
Master II

You may continue to determine the stocks at the end of the Month with a script like:


STOCK_PER_MONTHEND:
LOAD
*,
IF(MONTH(PEEK(Date)) <> MONTH(Date), Qty1) AS StockMonthEnd
RESIDENT
STOCK_PER_DATE
ORDER BY
Prod,
Date DESC;

DROP TABLE STOCK_PER_DATE;


Doing so, you will have one additional field showing always the last stocks at the last date for each month (and for each product).

edit: Have added a sample-file along with alternative way to calculate the stocks

HTH
Peter

View solution in original post

2 Replies
prieper
Master II
Master II

You may continue to determine the stocks at the end of the Month with a script like:


STOCK_PER_MONTHEND:
LOAD
*,
IF(MONTH(PEEK(Date)) <> MONTH(Date), Qty1) AS StockMonthEnd
RESIDENT
STOCK_PER_DATE
ORDER BY
Prod,
Date DESC;

DROP TABLE STOCK_PER_DATE;


Doing so, you will have one additional field showing always the last stocks at the last date for each month (and for each product).

edit: Have added a sample-file along with alternative way to calculate the stocks

HTH
Peter

deepakk
Partner - Specialist III
Partner - Specialist III
Author

Thanks Peter.... It worked Fine for Me............ Yes