Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
shri
Contributor II
Contributor II

Need help to sum up values in qlik sense

I need to add two values

i have attached a snap of my file in that i want an expression which will add two values

For ex: for Material 1011 and week 2 the Avail.qty is 500 so now i want to add "Req. qty from the row below it +Avail.qty above that row" how would i do it??

 

if you consider the first row then

Avail.qty=500

And Req.qty below that row is =10

i want to add 500+10= 510 (Since Req.qty is +10)

AND

if you consider 2nd row for Avail.qty then 

Avail. qty= 510

And Req.qty below that row is = -2

i want to add 510+(-2)= 508  (basically depending upon the sign of Req.qty ,the rows of Req.qty below the particular Avail.qty should get added or subtracted)

& so on...

MaterialDeli. dateweekelementsReq. qtyAvail.qty
101109-01-192A-5500
101111-01-192B10510
101104-02-196A-2508
101105-02-196A-10498
101105-02-196A-1497
101105-02-196A-2495
101105-02-196A-5490
101105-02-196A-8482
101105-02-196A-100382
101209-01-192A10500
101211-01-192B30530
101204-02-196A40570
101205-02-196A-20550

 

 

2 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

 

Data:
LOad * inline [
Material,Deli. date,week,elements,Req. qty,Avail.qty
1011,43709,2,A,-5,500
1011,43770,2,B,10,
1011,43557,6,A,-2,
1011,43587,6,A,-10,
1011,43587,6,A,-1,
1011,43587,6,A,-2,
1011,43587,6,A,-5,
1011,43587,6,A,-8,
1011,43587,6,A,-100,
1012,43709,2,A,10,500
1012,43770,2,B,30,
1012,43557,6,A,40,
1012,43587,6,A,-20,
];

Temp:
Load *,AutoNumber(Rowno(),Material) as Rownum Resident Data;


Final:
Load *,If(Rownum = 1,"Avail.qty",(Peek(NewQTY)+"Req. qty")) as NewQTY Resident Temp;
Drop table Data,Temp;

 

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
shri
Contributor II
Contributor II
Author

Will you please tell me which chart functions to use since i have attached data through Data Manager and not the data load editor.