Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
kdmarkee
Specialist
Specialist

Sorting groupings of rows in straight table

I'm hoping to get some ideas...

See attached qvw.  I want to apply a sort to a straight table that will allow all lines within an account to stay together as a group.  For example, I want to take this data and sort it (asc) by Date, StartTime, Account and Line which when done simply looks like this below (which is not what I want)...

sort bad.PNG

and what I really want is to be able to keep all the lines within an account together, like what you see below...

sort good.PNG

Can this be done and if so, in the chart properties or in script?  Thanks for you help.

1 Solution

Accepted Solutions
kdmarkee
Specialist
Specialist
Author

Thanks to a different post and the help of Stefan Wuhl, the correct info that solved my issue was:

sort.PNG

First priority should be Account, with a sort by expression like

=Min(RangeSum(Date,Alt(StartTime,0.99999)))

and sort numeric value also checked.

Next three dimensions are sorted by numeric value.

No sort on Code and expression.

View solution in original post

11 Replies
Gysbert_Wassenaar

Sort it by Account, Date, StartTime, Line instead.


talk is cheap, supply exceeds demand
antoniotiman
Master III
Master III

May be

vvira1316
Specialist II
Specialist II

How about following

Sort.PNG

kdmarkee
Specialist
Specialist
Author

Your screen shot seems to work with my simple dataset but after doing more testing with my actual app, I found a scenario where this won't work unfortunately.  If I first sort by Date then Account, I could end listing Accounts first with later star times.  I attached a revised qvw to show this.  Account 10 will end up in the wrong place because its start time is 9am and should not appear for accounts that have an earlier start time.  Here's a snippet:

sort snippet.PNG

Any other ideas?  Thanks.

kdmarkee
Specialist
Specialist
Author

This will not work for my situation because I need to first sort everything by Date.

antoniotiman
Master III
Master III

See Attachment

kdmarkee
Specialist
Specialist
Author

Bummer, your solutions always seem to work for my test qvw but not my actual qvw. 

For my own education, what does this actually do?

=Min(TOTAL Aggr(StartTime,Date,Account))


And I have added another qvw to show why this solution, although close, doesn't quite work.  Ideally I'd like to have the accounts sorted as well.  Refer to attached qvw.  You'll notice that accounts 11 and 99 are out of order because account 11 has a later start time but is listed first, and account 99 is listed before accounts 22 and 33 on 1/1/2017.  Any way to accommodate that by chance?  If not I may just have to forget about any kind of sorting on account, as the sort rules for Date, StartTime and keeping all the lines together within an account are the top priorities.

Thanks again.

kdmarkee
Specialist
Specialist
Author

Ignore the post dated 10/10; I have another qvw that gets me even closer to my ideal result.  The only problem with this qvw is that ideally I'd like the accounts to be sorted as well.  See desired screen shot image in the qvw.  Anyone know if I can accomplish that or is this as good as it gets?  Goal one was to have all lines of an account together and to list those "sets of data" by date and the first min start time per set.  Goal two would be also sort the "sets" by account number. Thanks.

kdmarkee
Specialist
Specialist
Author

Thanks to a different post and the help of Stefan Wuhl, the correct info that solved my issue was:

sort.PNG

First priority should be Account, with a sort by expression like

=Min(RangeSum(Date,Alt(StartTime,0.99999)))

and sort numeric value also checked.

Next three dimensions are sorted by numeric value.

No sort on Code and expression.