Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi all,
I want to make a sum based on two conditions, for example if it is the current month and if the weather is sunny, sum all sales.
What's the best practice and most efficient way of achieving this in Qlikview?
Cheers,
 marcus_malinow
		
			marcus_malinow
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi David,
One possible approaches is to use Set Analysis. This is far more efficient than If conditions when used in front end expressions.
For example:
sum({$<Month={'$(=Month(Now())'}, Weather={'Sunny'}>} Sales)
Marcus
 marcus_malinow
		
			marcus_malinow
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi David,
One possible approaches is to use Set Analysis. This is far more efficient than If conditions when used in front end expressions.
For example:
sum({$<Month={'$(=Month(Now())'}, Weather={'Sunny'}>} Sales)
Marcus
 
					
				
		
There is no need for nesting, it is simply
if(month = current month AND weather = sunny, expression for true, expression for false)
 consenit
		
			consenit
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi there.
I'd favor Set Analysis over IF statements almost any time:
=SUM({$<Wheater={'Sunny'}, Month={$(=MONTH(TODAY()))}>} Sales)
Kind regards,
Ernesto.
 
					
				
		
 richard_chilver
		
			richard_chilverDavid
Is it the case that you might have many combinations of conditions?
For example:
Current Month AND Sunny ...
Current Month AND Raining ....
Current Month AND Windy .....
Last Month AND Was Sunny ....
I agree nested IFs would get messy.
I'd be interested in views. Where appropriate, I try to deal with conditions like this in the script; it can often be handled more elegantly there.
Regards
 
					
				
		
Thanks all - done a little testing with Set Analysis and I am really impressed. Tidier and performs more efficiently than the IF AND statements.
