Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 jonathanrichey
		
			jonathanrichey
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I am working on a set analysis expression and it seams I have the logic reversed. I would like my chart to show data only within the last two years.
Where should the greater than or less than operators be used within the equation?
count({<MonthYear ={">=$(=Date(AddYear(MonthYear, -2), 'MMM YYYY'))"}>}ID)
 OmarBenSalem
		
			OmarBenSalem
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 avkeep01
		
			avkeep01
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi @jonathanrichey,
The ' aren't working. You could use this. You only need to make sure that the field Date has the same format as the default date settings at the beginning of your script.
=count({<Date ={">=$(=Date(AddYear(MonthYear, -2)))"}>}ID)
 
					
				
		
 jonathanrichey
		
			jonathanrichey
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks for the quick response @avkeep01 !
My date is set to=
SET DateFormat='M/D/YYYY';
Currently I have MonthYear as my dimension. I am not sure what is calculating when using the updated expression (see MonthYear.png.
If I change my dimension to Date vs MonthYear my data displays only November and December 2015 (Date.png).
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		May be you need this
Count({<MonthYear = {">=$(=Date(AddYears(Max(MonthYear), -2), 'MMM YYYY'))"}>} ID)UPDATE: fixed the function name to AddYears based on Omar's response below
 OmarBenSalem
		
			OmarBenSalem
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Or this
Count({<MonthYear = {">=$(=Date(AddYears(Today(), -2), 'MMM YYYY'))"}>} ID)UPDATE: fixed the function name to AddYears based on Omar's response below
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Good catch 🙂
 
					
				
		
 jonathanrichey
		
			jonathanrichey
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		This works as well.Thanks for the responses!!
