Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

loop problem, fifo

Hi All,

I have the following table:

Tab1:

Product          Value     Key      

1                    1000       A

1                    -600       

1                    -100       

1                    200         B

1                    -400       

2                    2000       C

2                    -800       

2                    -1200     

2                    1500      D

2                      500      E

2                    -500       

I need to use FIFO method (first in first out) and check which Key has not been fully used - so I need to receive the red Keys (can be in seperate table, can be in the original one).

My idea was to create first two tables: one with positive values and second with negative.

Then create some kind of loop that checks if:

-600 + 1000 >= 0 ok

-100 + (1000-600) >=0 ok

-400 + (1000-600-100) >=0 - false, then add to a new Tab2 next positive value = B.

So the result would need to be;

Tab2:

Product

1     B 

2     D

2     E

I am not sure if it is the best idea and if it is feasible at all. Any suggestions will be appreciated.

Thanks

0 Replies