Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
How to calculate stock with weighted average by using stock ledger?
 
					
				
		
 marcus_sommer
		
			marcus_sommer
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I think this will be helpful: Average – Which average?
- Marcus
 
					
				
		
 
					
				
		
 miguelbraga
		
			miguelbraga
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hey there,
Do you have a qvw in which you need that average so that we can provide a solution for your problem?
Thanks,
MB
 
					
				
		
In my stock i have same TWO quanties which i purchased at different rates follows:
srno Item qty product_rate value
1. A 10 1 10
2. A 6 1.5 9
Now in my stock have 5qty from my 1st purchase (with purchase rate as rs.1)
and 2nd purchase i have 6qty .
now as per me weighted avg: is =
total qty=5+6=11 and value=5+9=14
and product rate changes to rs.1.27
 
					
				
		
For weighted avg, you can try:
sum(Value)/sum(Qty)
 
					
				
		
 miguelbraga
		
			miguelbraga
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Or something like this:
= Sum(Value) / Count(Value)
 
					
				
		
 marcus_sommer
		
			marcus_sommer
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Within charts you could use something like this:
rangeavg(above(sum(value), 0, rowno(total)))
and within the script you could use peek() and previous() to access previous records: Peek() or Previous() ?
- Marcus
