Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
hey all,
I am facing a problem with Rolling 12 months bar chart. I want the chart to show the avg for each month(for 12 month from the month selected). And default to the latest month for which the data is available(If no month/year is selected). The following is my expression :
If(GetSelectedCount([Month ])=0 and GetSelectedCount([Year ])=0,
Only({$<MonthYearID={"<= $(=$(vMax)) >= $(=$(vMax)-11)"},Location = {$(=SubField(GetfieldSelections(Location),':',-1))} >}R_AvgCardSwipes),
Only({$<MonthYearID={"<= $(=max(MonthYearID)) >= $(=max(MonthYearID)-11)"},Location = {$(=SubField(GetfieldSelections(Location),':',-1))} >}R_AvgCardSwipes))
The Only() expressions works fine when alone but not when used with the if condition.
Thanks .
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Both Only expressions work stand alone? and both don't work when you make and clear selection???
 
					
				
		
Yes Sunny. Both expressions work when alone.
 
					
				
		
 sasiparupudi1
		
			sasiparupudi1
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		try
Only({$<Month =,Year=,MonthYearID={"<= $(=$(vMax)) >= $(=$(vMax)-11)"},Location = {$(=SubField(GetfieldSelections(Location),':',-1))} >}R_AvgCardSwipes),
 
					
				
		
Thanks. But there is no change.
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Is the problem that it isn't giving you the result you expect or its just not giving any result???
 
					
				
		
From what I can interpret, Values get passed to variables in both the expressions. Both expressions are selected.
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Well even if the value goes to both the expression, only one of the if statement clauses are going to be true. So either 1st expression or the 2nd expression is going to be evaluated.
What happens when you replace Only() with Avg(), May be there are more than one value to be displayed and Only just isn't possible.
 
					
				
		
Thanks Sunny. But the values are wrong .
I have found a work around. Instead of the if condition, I am using two charts with conditional hiding - One when no selection and other when there is a selection.
Thanks all.
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		May I suggest two expressions, instead of two charts? and conditionally hiding/showing them based on your condition. Just one less chart to worry about 
HTH
Best,
Sunny
