In stock1, I have Item 1 goes out of stock 1 at 15/01/2017, and goes in stock 2 at the same date. Also Item 5 goes Out on 28/1/2017.
In the second table (which I am trying to create in qlik sense) I will find only items that are in stock 1, and not all items that passed through. So I may have only : Item 2 and Item 4, which goes IN and never goes out.
And I need to create the table in the application not in load script, so I can by filtering on "MVT DATE" to have an image of the stock at this moment.
I did not yet have the time to test it, I don't have the qvf on my actual computer. I'll test tomorrow and get back to you. But from the results you have in your comment I'll say yes its will resolve my problem.
For the moment I do not have ITEM that get OUT of a STOCK and get back in later, so the fonction you have provided do correspond to my problem.
But for example if I have: Item 1 that get in in stock 1, than it goes out without going to other stocks (error in stock entry for example) and later on it goes in the stock 1 (manuel error correction), in the table I do not have it. If you have a solution it will be great, other wise I have very few cases so it may not be a problem in the reporting I am creating.