Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
collegehunkschr
Contributor II
Contributor II

How to sort days of the week dimension in order

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?

1 Solution

Accepted Solutions
trdandamudi
Master II
Master II

In Sort Expression use below:

match([Day of Week], 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')

View solution in original post

9 Replies
trdandamudi
Master II
Master II

See the attached:

You can also do this on the script side.

sergio0592
Specialist III
Specialist III

In properties/ Sort/Sort by expression, paste the following expression:

match(Day, 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')

collegehunkschr
Contributor II
Contributor II
Author

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?

collegehunkschr
Contributor II
Contributor II
Author

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?

collegehunkschr
Contributor II
Contributor II
Author

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
Master II
Master II

In Sort Expression use below:

match([Day of Week], 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')

collegehunkschr
Contributor II
Contributor II
Author

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
Specialist III
Specialist III

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

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