Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Accumulation

Hi,

I am attaching my excel,

here ws1 is the field which i need to devide based on quantity.

i am getting like this         

Part NoPosting DateQuantityTotal Qtyws1Cumulativeoutfield
0009799404/1/2016423415844
0009799403/31/2016100234158104100
0009799403/16/20161623415812016
0009799403/2/2016100234158220 38
0009799402/18/20164234158224 38
0009799402/16/201617234158241 38
0009799405/23/2015-4234158237 38
0009799405/22/2015-20234158217 38
0009799405/21/2015-2234158215 38
0009799405/20/2015-7234158208 38
0009799405/19/2015-4234158204 38
0009799405/18/2015-6234158198 38
0009799405/16/2015-16234158182 38
0009799405/15/2015-4234158178 38
0009799405/14/2015-8234158170 38
0009799405/12/2015-12234158158-12
00097994011/20/20142234158160 38
00097994010/23/201470234158230 38
00097994010/21/201413234158243 38
0009799405/21/2014-8234158235 38
00097994011/12/2013-1234158234 0

i want output like below.

my alocated it has to show 158 because ws1 is 158.

outfield should get from quantity.

        

Part NoPosting DateQuantityTotal Qtyws1Cumulativeoutfield
0009799404/1/2016423415844
0009799403/31/2016100234158104100
0009799403/16/20161623415812016
0009799403/2/2016100234158220 38
0009799402/18/20164234158224 0
0009799402/16/201617234158241 0
0009799405/23/2015-4234158237 0
0009799405/22/2015-20234158217 0
0009799405/21/2015-2234158215 0
0009799405/20/2015-7234158208 0
0009799405/19/2015-4234158204 0
0009799405/18/2015-6234158198 0
0009799405/16/2015-16234158182 0
0009799405/15/2015-4234158178 0
0009799405/14/2015-8234158170 0
0009799405/12/2015-122341581580
00097994011/20/20142234158160 0
00097994010/23/201470234158230 0
00097994010/21/201413234158243 0
0009799405/21/2014-8234158235 0
00097994011/12/2013-1234158234 0
20 Replies
Kushal_Chawda

see this

Data:
LOAD [Part No],
[Posting Date],
if(Cumulative<= ws1,1,0) as Flag,
Quantity,
[Total Qty],
ws1,
Cumulative
FROM
[Accumulation.xlsx]
(
ooxml, embedded labels, table is Sheet1);

Accu:
LOAD *,
if(Flag=0 and Previous(Flag)=1,Outfield2,
if(Flag=0 and Previous(Flag)=0,ws1-(Outfield1+Outfield2),
if(Cumulative= ws1,0,Outfield1))) as Outfield;
LOAD *,
if(Flag=0 and Previous(Flag)=1, ws1-Outfield1, if(Flag=0 and Previous(Flag)=0, Peek('Outfield2'),0)) as Outfield2;
LOAD *,
if(Flag=1,Quantity,
if(Flag=0 and Previous(Flag)=1, Peek('Cumulative'),
if(Flag=0 and Previous(Flag)=0, Peek('Outfield1')))) as Outfield1
Resident Data
Order by ws1,[Posting Date] desc ;

DROP Table Data;