Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi all!
Please find image attached:
Mc = Count(total <DESTINAZIONE, MEZZO> MVCDE) * MZPRT // MVCDE and MZPRT are two db fields
Tot Mc = sum(total <DESTINAZIONE> Mc)
Why am I getting 0 values as result? I don't understand where I'm making mistake, the red values shown in figure are the result I would expect...
Do you need to know more details about db structure?
Thanks in advance.
--
Marco Pikiri
 
					
				
		
 giakoum
		
			giakoum
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Sum(total<DESTINAZIONE> aggr(distinct Count(MVCDE)*MZPRT, DESTINAZIONE, MEZZO))
 
					
				
		
 giakoum
		
			giakoum
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		maybe because * MZPRT is not part of any aggregation function
 
					
				
		
Each "MEZZO" ("DUMPER 1", "DUMPER 2", etc.) has its own MZPRT: which should be the right aggregation function to use in this case? Seeing from documentation "Only()" function, I suppose: is that right?
 
					
				
		
 giakoum
		
			giakoum
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		only is automatically used by QlikView when there is no other stated. try min or max, both should work as it is only one value for each mezzo
 
					
				
		
Changing "Mc" expression to:
Count(total <DESTINAZIONE, MEZZO> MVCDE) * min(total <MEZZO> MZPRT)
or to:
Count(total <DESTINAZIONE, MEZZO> MVCDE) * max(total <MEZZO> MZPRT)
still outputs 0 values again
But as of my newbieing to QV now another question arises: is it correct the "total <MEZZO> " notation I've put above in the min-max functions?
 
					
				
		
 giakoum
		
			giakoum
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		maybe a sample file would help solve this faster
 
					
				
		
Sure ok, let's try.
Thanks.
 
					
				
		
 giakoum
		
			giakoum
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		There is no such field as Mc :
So in Tot Mc expression : =sum(total <DESTINAZIONE> MVCDE)
should work
 
					
				
		
In fact Mc is an expression, not a field.
Values output by:
=sum(total <DESTINAZIONE> MVCDE)
are not correct, i.e. for the ALTRO "DESTINAZIONE" we will have:
27 + 17.5 = 44.5
and not 124 as I can see. There should be a sum of "Mc" expressions, not of MVCDE field.
Please see that MVCDE in my db is an auto-incremental ID field that I use just to count the occurrences of what I'm evaluating.
 
					
				
		
 giakoum
		
			giakoum
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		what expression is Mc? The previous column?
