Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 Joda
		
			Joda
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello everyone,
I would like to use an if-condition in a variable to calculate, if i need set analysis or not. So the set analysis is supposed to include a field selection or there is no field selection at all, depending on the if-condition in the variable.
Here is my calculation in the chart:
=sum({<Week={"=$(=vWeek)"}>} SomeField)
The variable in that sum is defined as follows: vWeek =if(GetSelectedCount(Week)>0, max(Week), '*')
But everytime QlikView interprets the * as some text and does not show anything at all, because the field Week includes values from 1 to 52.
Thank you for your answer 🙂
Joda
 bharathadde
		
			bharathadde
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try this
vWeek =if(GetSelectedCount(Week)>0, max(Week) , Concat(distinct Week,chr(39) & ',' & chr(39)) )
Calculation
=Sum({<Week={'$(=vWeek)'}>} Sales)
 carahyba
		
			carahyba
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 bharathadde
		
			bharathadde
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try this
vWeek =if(GetSelectedCount(Week)>0, max(Week) , Concat(distinct Week,chr(39) & ',' & chr(39)) )
Calculation
=Sum({<Week={'$(=vWeek)'}>} Sales)
 Joda
		
			Joda
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello Bharathadde,
Thanks for your reply 🙂
It works!!
 Joda
		
			Joda
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hello Carahyba,
Thanks for your reply!
I read the replies in that thread and it turns out that they come up with the same solution, provided by Bharathadde.
 ViktoriyaParshi
		
			ViktoriyaParshiHello,
Maybe, somebody faced this problem and could help me :-).
I created the calculated column. After the receiving the results, I need remove "Null"s
"Expressions" returns me the correct results, but impossible remove Null values in model
Calculated dimension, where Null remove is possible, - presents not correct results .
my calculation is:
=if (T_Number = Max_T_Number or (IsNull (T_Number) and Qty_On_Hand > 0.1 ), 'New', Null())
| Number | T_Number | Max_T_Number | Expressions | Calculated dimension | Qty_On_Hand | 
| ABC1 | New | 1 | |||
| ABC2 | T119565 | T119566 | New | New | |
| ABC3 | New | 1 | |||
| ABC4 | T119568 | T119568 | New | New | |
| ABC5 | 
thank you!
