Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
I have a field that is Day of the Week. The problem is that there's no option in the sort function when creating a table or a graph to manually order the order in which they display. So they just display in whatever order, as opposed to Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
Can anyone help with this?
 trdandamudi
		
			trdandamudi
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		In Sort Expression use below:
match([Day of Week], 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
 trdandamudi
		
			trdandamudi
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		See the attached:

You can also do this on the script side.
 
					
				
		
 sergio0592
		
			sergio0592
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		In properties/ Sort/Sort by expression, paste the following expression:
match(Day, 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')
 
					
				
		
I can't see the .qvw file because i'm using the personal edition. Can you give me the expression to use to sort on the script side, so that I can paste it in the expression field in the sort panel for the chart properties?
 
					
				
		
I tried this and it didn't do anything. My field is named Day of Week. Do I need to put brackets, parentheses, quotes or something else around that term in place of where you have Day?
 
					
				
		
The table version is not sorting my days of week, it's just adding an extra column that I don't want for value. That would make it difficult to create charts, because I would have to include the value as a dimension to be sorted. I want that same effect, but I want the value of the day to stay forever hidden.
 trdandamudi
		
			trdandamudi
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		In Sort Expression use below:
match([Day of Week], 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
 
					
				
		
You are my hero. Please follow all of my many questions to come, because I could use all the help I can get lol!
 
					
				
		
 sergio0592
		
			sergio0592
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Or you can use dual() with :
LOAD DUAL ( string,num) as Day
INLINE
[ string,num
Monday,0
Tuesday,1
Wednesday,2
Thursday,3
Friday,4
Saturday,5
Sunday,6 ];
And sort on num field
 
					
				
		
 MarcoWedel
		
			MarcoWedel
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Struggling with sorting expressions IMO only is your second best approach. Load your [Day of Week] field as a proper dual value and the correct order comes out of the box...
hope this helps
regards
Marco
