Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 afa24
		
			afa24
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi
I have only just started using Qliksense and need some help.
This is my current expression;
=if(Year >= 2015 and Year < 2022,Year,NULL())
There is no data before 2016 hence why i hardcoded the 2015, but i dont want to hardcode the max year(and have to go in each year and update the max year) but i am unsure how to write the expression.
If i dont specify a year it brings across data year types. Any help would be greatly appreciated
Thanks
.png) Sweta_Sharma
		
			Sweta_Sharma
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi @afa24 .
Year(Today()) can be used for current or max year.
Cheers!
.png) Sweta_Sharma
		
			Sweta_Sharma
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi @afa24 .
Year(Today()) can be used for current or max year.
Cheers!
 anthonyj
		
			anthonyj
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi,
I would add that since you have no data before 2016 you won't need to add the ">=" part of the condition and instead of using an "If" condition in your dimension, use set analysis in your measure. This will result in the max year being taken from the max year in your data.
For example:
count({$<year={"<$(=max(year))"}>}Column)
Thanks
Anthony
 afa24
		
			afa24
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks for that - i changed the bit of code to the following
=if(Year >= 2015 and Year <= year(today()),Year,NULL())
and it worked!
Thanks for the help
 afa24
		
			afa24
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Hi Anthony - ill need to do some further investigation on the set analysis in the measure - . Thank you for the reply and ill see what i can find with the set analysis
