Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

Calculation between rows

I have raw table1 as below.  ITEM_No is product identity; Qty is the need for each STO; Stocks is the same for each product. 

Below Table2 is the result i want to get.  For each distinct article, when the Stocks_Remaining  below zero, i wish to have a comment as "N" and before the Stocks_Remaining  reach zero, i wish to have a comment as "Y" for these stores.

Attached are an QVW file incudling the raw data and an excel file that shows how we do it in excel.

I have no idea how to get this result table through Qlikview. Could someone help here in QLIKVIEW?

Table1   
ITEM_NOSTO NumberQTYStocks
001695600018200
001695600028200
001695600038200
001695600048200
001695600058200
001695600068200
0016956000716200
001695600088200
001695600098200
001695600108200
001695600118200
001695600128200
001695600138200
001695600148200
0016956001516200
0016956001616200
001695600178200
001695600188200
001695600198200
001695600208200
0016956002116200
0016956002216200
001695600238200
001695600248200
001695600258200
001695600268200
0016956002716200
0016956002824200
302342290011020
302342290021020
302342290031020
302342290041020
302342290051020
302342290061020
302342290071020
302342290081020
302342290091020
302342290101020

 

Table2     
ITEM_NOSTO NumberQTYStocksStocksRemaining_CalculationDecision
001695600018200192Y
001695600028200184Y
001695600038200176Y
001695600048200168Y
001695600058200160Y
001695600068200152Y
0016956000716200136Y
001695600088200128Y
001695600098200120Y
001695600108200112Y
001695600118200104Y
00169560012820096Y
00169560013820088Y
00169560014820080Y
001695600151620064Y
001695600161620048Y
00169560017820040Y
00169560018820032Y
00169560019820024Y
00169560020820016Y
00169560021162000Y
0016956002216200-16N
001695600238200-24N
001695600248200-32N
001695600258200-40N
001695600268200-48N
0016956002716200-64N
0016956002824200-88N
30234229001102010Y
3023422900210200Y
302342290031020-10N
302342290041020-20N
302342290051020-30N
302342290061020-40N
302342290071020-50N
302342290081020-60N
302342290091020-70N
302342290101020-80N

 

1 Solution

Accepted Solutions
Highlighted
Specialist II
Specialist II

Re: Calculation between rows

Hi,

Please find in attached the Qlikview file

output:

Capture.PNG

Regards,
Taoufiq ZARRA

View solution in original post

2 Replies
Highlighted
Specialist II
Specialist II

Re: Calculation between rows

Hi,

Please find in attached the Qlikview file

output:

Capture.PNG

Regards,
Taoufiq ZARRA

View solution in original post

Highlighted
Contributor II
Contributor II

Re: Calculation between rows

Hi Taoufig,

That works and help me to expand my knowledge.

Really thanks for your professional answer.