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: 
ahmd
Contributor II
Contributor II

Stock and Sales Subtraction

Hi,

I want to subtract sales from stock in script.

scenario: I have ST of product A and Product B and SL takes place on different dates. When the SL sold out from product A then product B needs to be substract.

Such as on 22.01.2021, ST Product A was 18 and items sold out until 29.01.2021 but on this dates total remaining ST Product A was 3 and Sold items were 4 so 3 - 4 = -1. So 3 items should be subtract from Product A and 1 items should be subtract from Product B. and also mark it in last 2 columns that the sold items take place from Product A or Product B.

 

Main ProductSub ProductDateST Product AST Product BSLSL from Product ASL from Product B
AAA10.02.2021  20155
AAA09.02.20211551 1
AAA06.02.2021  1 1
AAA05.02.2021  1 1
AAA04.02.2021  1 1
AAA03.02.2021  1 1
AAA02.02.2021  1 1
AAA01.02.2021  1 1
AAA31.01.2021  1 1
AAA30.01.2021  1 1
AAA29.01.2021 5431
AAA28.01.2021  44 
AAA27.01.2021 222 
AAA26.01.2021  22 
AAA25.01.2021 311 
AAA24.01.2021  33 
AAA23.01.2021  22 
AAA22.01.202118 11 

 

0 Replies