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: 
sarahshong
Contributor III
Contributor III

Data not sorting as expected

I am trying to use an above function by aggregation in a straight chart. However, after noticing the inconsistency of the outputs I realized that the above function is applying to a unsorted order. When I bring in a rowno() by the same aggregation into a new column, I can clearly see that the dates are out of order

You can see that from line 1087 to 1086, the dates jump several years. 20250131 which should be the next date in this list, is all the way at row 272. 

 

I have used an order by in the final table in the script with these same dimensions, but the weird sorting seems to not change. Any ideas on how to get this sorted correctly?

 

sarahshong_0-1740605498134.png

 

Labels (2)
1 Solution

Accepted Solutions
Or
MVP
MVP

I don't see any indication of sorting in your Aggr() function... without sorting definitions, data will be sorted in the load order within the aggr().

https://community.qlik.com/t5/Design/The-sortable-Aggr-function-is-finally-here/ba-p/1470262

 

View solution in original post

3 Replies
morgankejerhag
Partner - Creator III
Partner - Creator III

Maybe it is about order? You say that you want to measure to sort first by month and then by date. If you switch those around? aggr(rowno(),Product,Tyhpe,Date,Contract_Month,CYNum2)

(maybe Contract_Month and possible CYNum2 are not necessary if date is already on a lower level)

Or
MVP
MVP

I don't see any indication of sorting in your Aggr() function... without sorting definitions, data will be sorted in the load order within the aggr().

https://community.qlik.com/t5/Design/The-sortable-Aggr-function-is-finally-here/ba-p/1470262

 

sarahshong
Contributor III
Contributor III
Author

this worked perfectly, thank you!