Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 imallears
		
			imallears
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi, Can I have an expression in a chart that can both sum and average depending on selection? I'm currently using two charts, one hidden which uses if(sum when a certain selection (user) is made.
The issue I'm having is when the user selection is chosen first it jumps to the hidden chart which has the sum expression is used when indeed I need the average chart displaying.
Thanks!
 Kushal_Chawda
		
			Kushal_Chawda
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		try this expression
if(getselectedcount(YourField1)>=1, Sum(Amount),
if(getselectedcount(YourField2)>=1, Avg(Amount),Sum(Amount)))
 
					
				
		
 swuehl
		
			swuehl
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		You can also look into using a single chart with conditional expressions, i.e. you would create multiple expressions and enable 'Conditional' with a condition set like
=GetSelectedCount(FIELD)>0
resp.
=GetSelectedCount(FIELD)=0
I believe using conditional expressions. QV won't need to calculate both aggregations, the sum and the average when only one is needed.
 
					
				
		
 MarcoWedel
		
			MarcoWedel
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Please post a sample application
Thanks
Regards
Marco
 
					
				
		
 MarcoWedel
		
			MarcoWedel
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If you want user dependent expressions then OSUser()='some name' might work as condition.
 trdandamudi
		
			trdandamudi
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		See if the below link will help :
Drilldown charts with values and percentages on the stacked bar
