Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 richard_chilver
		
			richard_chilverI have a chart which selects the most recent 7 days of activity, then uses the WEEKDAY function of those 7 days to produce values in the chart:
I wish these to be displayed in date order. If today is Tuesday, the chart should (last) Wednesday through to today(Tuesday).
I cannot get the sort to work; I have tried using the activity date as a sort expression.
Apologies if a similar question has previously been answered.
Thanks & Regards
 
					
				
		
.png) hic
		
			hic
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If you use
Dual( WeekDay(Date), Date )
as dimension - either defined in the script or as calculated dimension, QlikView will display WeekDay but sort (numerically) according to date. Which is what you want.
HIC
 
					
				
		
Hey Richard,
I used Weekday(Today()) in Expressions in Sort. Check out the attached file and see if it helps.
Thanks
AJ
 
					
				
		
.png) hic
		
			hic
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If you use
Dual( WeekDay(Date), Date )
as dimension - either defined in the script or as calculated dimension, QlikView will display WeekDay but sort (numerically) according to date. Which is what you want.
HIC
 
					
				
		
 richard_chilver
		
			richard_chilverHi Henric
Thanks for the helpful answer. It works ... and I now have to go and understand why 
Richard
 
					
				
		
.png) hic
		
			hic
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		The secret is in the Dual( ) function. Each field value has a text component and a numeric component. Read more on http://community.qlik.com/blogs/qlikviewdesignblog/2012/11/13/dual.
In your case, you display the textual part (weekday, the first parameter of the dual function) but you sort by the numeric value (the second parameter of dual).
HIC
