Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 khaycock
		
			khaycock
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Is there anyway to make an expression that is based on the selection of the year?
At the moment, I have expressions that include variables for current year-to-date and prior year-to-date so they show data for 2018 and 2017. But i have data going back other years that would be good to see year-on-year for so depending on the selected year, I would want to see the year-to-date for that year and then the year-to-date for the year before.
Is that possible?
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Year to date when year is selected will be the whole year, right?
 MK_QSL
		
			MK_QSL
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I think you have used Today() in your YTD and LYTD expressions.
Just replace Today() with user selected dates... i.e. Max(YourDateField)
Something like below..
Date Level Analysis - WTD, MTD, QTD & YTD (Current Year & Previous Year)
 
					
				
		
 jonathandienst
		
			jonathandienst
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Use set expressions with syntax along these lines
{<Year = {'$(=Max(Year))'}, ... >}
{<Year = {'$(=Max(Year)-1)'}, ... >}
You may need to override the actual selection, if you are making date selections in fields other than year. Max() will produce the latest (current) year when nothing is selected, or the selected year if when a selection is made.
 
					
				
		
 avinashelite
		
			avinashelite
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		In your case set the YTD for all the years base on the date and use the addyear() function mark the required year to date
 khaycock
		
			khaycock
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		But I was thinking that I would need an expression to have a year-to-date based on the month picked so if March
But I think I need an expression that shows YTD regardless of the year clicked so at the moment its 2018 and 2017 but if 2015 was selected then it needs to show that instead? Does that make sense?
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		So, in that case a front end set analysis based expression is the way to go... Manish shared links where you can look at the set analysis that can be used
