Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression Sorting

http://screencast.com/t/JoEF5nuBL.  I have this dimension wich is gouped.  It starts with month/year then when clicked goes to the day level.  When I sort, I choose expression then put in month.  The issue is when I click on the arrow for grouping and show dates they don't sort.  If I choose the date when sorting then the months are wrong.  How do I write an expression that will sort by month when showing months and dates when showing dates?

4 Replies
sivarajs
Specialist II
Specialist II

Its better to do in script level.

Use order by desc/asec in script

Sivaraj S

Jason_Michaelides
Partner - Master II
Partner - Master II

Looking at your month format I wonder if QV is actually recognising it as as date field.  How are you defining month in your script?  Or does it come in like "March 2012"?

Not applicable
Author

It does come in as March 2012, but when I do this http://screencast.com/t/e343VPGk4Er, it sorts correctly.  But in that expression I am not sure how to do month and day, depending on what the user is looking at. 

Jason_Michaelides
Partner - Master II
Partner - Master II

Maybe try loading the Month and Year yourself from the date field.  This way QlikView should retain the underlying numeric value and sorting should be OK.

LOAD

     Field1,

     Field2,

     Field3,

     etc,

     Date,

     Date(Date,'MMMM YYYY')     AS     MonthYear

FROM....;

Then in your cyclic dimensions just use Date and MonthYear

Jason