Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 rfigueroa
		
			rfigueroa
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
In the example attached, I would like to add a fourth column so their value will be the current Quantity minus the Quantity value from the first Purchase for the same Product.
For example for product A, Fx will be Qty - 10 which is the value from the first purchase:
productID dtPurchase Quantity Fx
A 01/01/2000 10 0
A 01/02/2000 9 1
A 01/03/2000 8 2
I know that's very simple for you guys...hope can you help me.
Thanks in advance.
Cheers.
Roberto
 
					
				
		
 johnw
		
			johnw
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		This seems to be working, though I didn't check it particularly carefully:
Quantity-firstsortedvalue(total <productID> Quantity,dtPurchase)
 
					
				
		
 matt_crowther
		
			matt_crowther
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Roberto,
Try top(Quantity) as you'r expression - it works for me in your example file.
You can of course use top(total Quantity) to take the very first record.
Hope that helps,
Matt - Visual Analytics Ltd
 rfigueroa
		
			rfigueroa
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thank you Matt, but seems the results change when we change the order. I need an expressions that returns always the first Quantity value from the first purchase for each product.
Robert.
 
					
				
		
 johnw
		
			johnw
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		This seems to be working, though I didn't check it particularly carefully:
Quantity-firstsortedvalue(total <productID> Quantity,dtPurchase)
 rfigueroa
		
			rfigueroa
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		works perfect! thank you John.
