Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 bbergstrom
		
			bbergstrom
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		In Qlik Sense I am trying to create a variable, or even a master dimension, that checks to see if the date on the record is between to variable dates. I have tried the following and it is giving me an Invalid dimension:
IF(FEFTCount=1 AND [Transaction Date]>=$(vDateFrom) AND [Transaction Date]<=$(vDateTo),ExceptVehFuelType)
The [Transaction Date] and two variable fields have the same date format.
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Alternatively, you can create the new variable like this
If(IsNull(GetFieldSelections([Transaction Month])) and IsNull(GetFieldSelections([Transaction Week])), Addmonths(Today(), -20), Min(TOTAL TranDateTime))
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		How do you define vDateFrom and vDateTo variables? Make sure they have equal in front of the variable definitation
 bbergstrom
		
			bbergstrom
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Doing that broke other visualizations. Here is the definition:
IF(ISNULL(GetFieldSelections([Transaction Month])) AND ISNULL(GetFieldSelections([Transaction Week])),Date(Addmonths(Today(),-20),'MM/DD/YYYY'),DATE(MIN(TranDateTime)))
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		May be create a new set of variable for this calculated dimension?
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Alternatively, you can create the new variable like this
If(IsNull(GetFieldSelections([Transaction Month])) and IsNull(GetFieldSelections([Transaction Week])), Addmonths(Today(), -20), Min(TOTAL TranDateTime))
 bbergstrom
		
			bbergstrom
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		So this variable sets a starting date for set analysis. Why would I add TOTAL?
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		A calculated dimension cannot have an aggregation (Like Min, Max, Sum, Avg) without TOTAL (one value across the whole dashboard) or without Aggr() (if you need multiple values based on a single dimension or multiple dimensions. In other words, when you have Min(Date) in your calculated dimension, it take it as null. But if you do Min(TOTAL Date) it gives you the Min date across the whole dashboard based on your selections. =Min(Date) does a similar thing where it evaluate to expression to a single value and then passes the value to the calculated dimension. So, now you don't have Min(Date) going into your calculated dimension, but the actual value (for instance 01/01/2018).
Does that make sense?
 bbergstrom
		
			bbergstrom
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Sort of but this variable is currently working in the set analysis I have. I am not trying to put this variable into a table.
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		All I am saying is to create a new variable with new expression. Don't make changes to a variable which is already working elsewhere  . Not sure if this is something you cannot do or not want to do
. Not sure if this is something you cannot do or not want to do
 bbergstrom
		
			bbergstrom
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		It worked after I tweaked some of the other data points, thanks!
