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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
maxsheva
Creator II
Creator II

Sort first by Field1 and then by Field2

Hi,

How can I make sort first by Field1 and then by Field2?

LOAD * INLINE [

Name, DateEntering, DateGraduation

Name1, 01/02/2010, 01/14/2017

Name2, 01/02/2010, 01/15/2017

Name3, 01/01/2010, 01/01/2017

];


I need first sort by DateEntering and then by DateGraduation.

As a result next


Name, DateEntering, DateGraduation

Name3, 01/01/2010, 01/01/2017

Name1, 01/02/2010, 01/14/2017

Name2, 01/02/2010, 01/15/2017


Forgot to add that I need make it in an object properties.


Thx.



14 Replies
sunny_talwar

Try this:

DateEntering + DateGraduation/1E10

maxsheva
Creator II
Creator II
Author

Thank you Sunny, your solution is worked as usual.

Would you please explain why should we divide on this value '1E10'?

Sorting also is working without that.

sunny_talwar

It is just giving a slight lower weight to the dategraduation. Adding 1e10 will be advisable because there might be a scenario where it might cause issues....top of my head, I can't come up with a scenario, but if you need I can come back and provide one where it might not work....

maxsheva
Creator II
Creator II
Author

OK, got it thx.

And one more question pls.

If I need sorting by more than one field I just use '+' sign and add expression.

For second and other fields I add lower weight by using '1E10'
Am I right?

sunny_talwar

Yes, but if those are lower weighted then DateGraduation, I would divide by 1E11. The max you can can use is 1E14...so you can start accordingly. For example

Field1 + Field2/IE8 + Field3/1E10 + Field4/1E12 + Field5/1E14