Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
LDR
Creator II

Pivot Table - Start with initial stock and substract demand row by row

Hi everyone,

What I'm going to ask you is something that I know how to solve via Script Editor but using a Pivot Table. So like I said, my goal is to achive it using functions charts inside a Pivot table.

Let me show you the result I want first:

LDR_1-1680602055630.png

Important to take in mind:

  • For each Part and for the first record, column C gets the initial stock we have for each part. For the next record and same part column C gets the value from E (if the value is negative then my initial stock has to be 0). 
  • D contains the amount of parts that I have to deliver according each date (column B).
  • E says the final stock I have after deliverying quantities so it's the result of substract D from C.

The closest approach I achieved in Qlik was using Above() function however, I wasn't able to modify the initial stock from the second record of each Part.

LDR_2-1680602661206.png

My datasets are the next below:

Stocks:
LOAD
Part,
Stock
INLINE [
Part, Stock
A, 100
B, 1
C, 200
D, 222

] (delimiter is ',');


Demand:
LOAD Part,
"Date",
Quantity
INLINE [
Part, Date, Quantity
A, 2023-04-04, 50
A, 2023-04-05, 51
A, 2023-04-06, 52
B, 2023-04-04, 5
B, 2023-04-05, 15
B, 2023-04-06, 25
C, 2023-04-04, 150
C, 2023-04-05, 175
C, 2023-04-06, 200
D, 2023-04-04, 152
D, 2023-04-05, 172
D, 2023-04-06, 202
](delimiter is ',');

Is it possible to do what I need via chart functions? how?

Thanks in advance

Labels (3)
0 Replies