Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
All,
Attached is a sample Qlikview data, want to calculation media by type ,but use media function , can't get correct result,
attachment is test value.
| type | date | sum(value) | median(total <type> aggr(sum(value),type)) | 
| M001 | 20131201 | 3,407,673 | 27,468,149 | 
| M001 | 20131202 | 3,704,435 | 27,468,149 | 
| M001 | 20131203 | 3,646,972 | 27,468,149 | 
| M001 | 20131204 | 3,584,327 | 27,468,149 | 
| M001 | 20131205 | 3,305,340 | 27,468,149 | 
| M001 | 20131206 | 2,760,666 | 27,468,149 | 
| M001 | 20131207 | 2,269,946 | 27,468,149 | 
| M001 | 20131208 | 2,025,425 | 27,468,149 | 
| M001 | 20131209 | 448,764 | 27,468,149 | 
| M001 | 20131210 | 2,314,601 | 27,468,149 | 
| M002 | 20131201 | 34,235,263 | 261,747,333 | 
| M002 | 20131202 | 34,434,302 | 261,747,333 | 
| M002 | 20131203 | 34,992,754 | 261,747,333 | 
| M002 | 20131204 | 3,121,676 | 261,747,333 | 
| M002 | 20131205 | 30,514,319 | 261,747,333 | 
| M002 | 20131206 | 20,516,230 | 261,747,333 | 
| M002 | 20131207 | 22,160,540 | 261,747,333 | 
| M002 | 20131208 | 32,114,195 | 261,747,333 | 
| M002 | 20131209 | 26,649,151 | 261,747,333 | 
| M002 | 20131210 | 23,008,903 | 261,747,333 | 
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Because the median itself is an aggregation function. And, there is nothing great making anything unnecessarily difficult, so it's easy . 
Please mark 'Correct Answer' and close the thread.
 
					
				
		
 lironbaram
		
			lironbaram
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		when using aggr function
it's important to include all the dimensions relevant to the aggregation level
use this function
Median(total <type>aggr(sum(value),type,date))
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		May be a bit simpler like this?
median(total <type> value)
 
					
				
		
Thanks,it;s right
I calculation median of the gap with sum(value) and Median(total <type>aggr(sum(value),type,date)) ,but then occur nothing,can't calculation again?
 
					
				
		
Yes ,the result is right ,why the formula so easy, thanks
 tresesco
		
			tresesco
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Because the median itself is an aggregation function. And, there is nothing great making anything unnecessarily difficult, so it's easy . 
Please mark 'Correct Answer' and close the thread.
 
					
				
		
Could you help check I replay under Liron Baram , Thanks.
