Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hello All,
In my script I set up a variable:
LET v90 = num(today()-90);
Within the charts etc, I need to count the number of cases where the date is greater or equal to the variable;
Something like Count({$<Date = {'>=$(v90)}>}Case)
Just cant work out the correct syntax! Any Help would be great thanks!
BR.
 
					
				
		
 gandalfgray
		
			gandalfgray
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Try this:
In the load script:
Let v90 = Date(today()-90);
In the charts expression:
count({$<Date={">=$(v90)"}>} Case)
 
					
				
		
Let v90 = Date(today()-90);
is generating a date of 30/12/1899
Any ideas?
 
					
				
		
 rahulgupta
		
			rahulgupta
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
You have use num() in your Variable declaration syntax and comparing a date field with that..May be this may be the Reason for data Type Mismatch...
So,you may convert the Variable v90 to the Date Data Type.
 
					
				
		
 gandalfgray
		
			gandalfgray
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I don't know really.
Let v90 = Date(today()-90);
is generating a date of 01/11/2011
for me (as expected).
.png) 
					
				
		
 Miguel_Angel_Ba
		
			Miguel_Angel_BaHello,
What it may be happening here is that your date is being evaluated twice, so Date(Today()-90) = "11/01/2011" so its doing 11 / 1 / 2011 which returns a decimal numeric value of 0,000546. Date(0,000546) is actualy 30/12/1899 which is the epoch (day zero) for QlikView. Further explanation on this behavior an be found here.
How are you building your expressions? How are you expanding the variable?
Hope that helps.
 rcurlewis
		
			rcurlewis
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Jeremy,
Not sure this will resolve you issue, but I found that when I create a variable on the front end (not via the script), I HAVE to include the "=" sign before the expression. When you check a TEXT box, both works, but when you put it in an expression the one without the "=" does not work.
I.e. My Variable vMaxPeriod defined as: =Max([Fin Period])
and my Expression: Avg({<[Fin Period]= {'$(vMaxPeriod)'}>} [Summary Score])
Hope this helps
 
					
				
		
Thanks Robert, that solved a problem that had been driving me nuts for hours!
 rcurlewis
		
			rcurlewis
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Jeremy,
Maybe the easiest would be this:
=count(if(Date >= v90, 1))
or
=count(if(Date >= $(v90), 1))
But I understand that this is not in the Set Analysis....
Regards
