Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 davymichiels
		
			davymichiels
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi there,
I am looking for a solution for the following problem:
I need to get a future potential stock figure for every article in the selection (Actually I need to visualize when the stock will be insufficient)
My dimension = the article
My expressions = the incoming and outgoing order nrs, order quantities and dates
Table is sorted on these dates
Now, how can I get Qlikview to calculate column 'POTENTIAL' ?
| article | stock today | incoming order | incoming date | incoming qty | uitgoing order | outgoing date | outgoing qty | POTENTIAL | 
|---|---|---|---|---|---|---|---|---|
| article A | 500 | 125665 | april 15 | +200 | 700 | |||
| article A | 500 | 355601 | april 20 | -500 | 200 | |||
| article A | 500 | 357022 | april 27 | -500 | -300 | |||
| article B | 90 | 351055 | april 14 | -80 | 10 | 
Kind regards
Davy
 Chanty4u
		
			Chanty4u
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		just u can add one more expression to ur table as Potential.
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		May be this:
Table:
LOAD article,
[stock today],
[incoming order],
[incoming date],
[incoming qty],
[uitgoing order],
[outgoing date],
[outgoing qty],
Alt([incoming date], [outgoing date]) as DateSort
FROM
[https://community.qlik.com/thread/211744]
(html, codepage is 1252, embedded labels, table is @1);
FinalTable:
LOAD *,
If(article = Peek('article'), RangeSum(Peek('POTENTIAL'), [incoming qty], [outgoing qty]) , RangeSum([stock today], [incoming qty], [outgoing qty])) as POTENTIAL
Resident Table
Order By article, DateSort;
DROP Table Table;
 davymichiels
		
			davymichiels
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks for the info but I ain't so good in scripting...
The article and order data are already 2 databases loaded in te script.
So i'd like to find the solution without messing with the script.
In the extra expression "potential" I can calculate on 'stock today'
but the 2nd line should be calculated not on stock today but on previous line in "potential"
and that is where I'm stuck.
I can't get all the in and outcoming on 1 line because I need 1 line per date
