Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sort order for combined fields and expression

Hi,

in my dimension i have combined profession and gender i.e.

Bus driver - Man

Bus driver - Woman

Nurse - Man

Nurse - Woman

In my chart i want to sort the lowest salary of women but at the same time keep the professions "grouped" so to speak. so that this doesn't happend:

Bus driver - Man

Nurse - Woman

Bus driver - Woman

Nurse - Man

How can i achive this?

And one more thing. Is there a way to let users decide sort order in a chart?

Thanks in advance!

//A.

1 Solution

Accepted Solutions
whiteline
Master II
Master II

Hi.

First, try remove quates and use $(=Expression)  as sort expression.

Of course there should be only one Expression selected.

View solution in original post

6 Replies
whiteline
Master II
Master II

Hi

You can use a complex sort expression.

Your example is too simple to suggest anything more specific.

And yes, you can allow the user to select the sort order. For example you can load some sort expressions in a field and use selected value as a sort expression.

Anonymous
Not applicable
Author

Hi,

Ok. I'm obviously not as good as you when it comes to writing complex sort expressions so this is what i need help with. Please give me an example.

thanks again,

A.

whiteline
Master II
Master II

Your example is too simple to suggest anything more specific.

As for sorting. The easiest way is to load your data in the right order.

Then you can use Load Order to sort. And if you want to achive the same with expression you can use:

=FieldIndex('profession', profession)

Then you can combine it with women salary:

=Sum(Salary) + 10000000*FieldIndex('profession', profession)

You can also replace '10000000' with the maximum Salary value calculated once in a variable.

Having more than one such different sort expresisons you can load them as string field in a table.

Then you can use =$(ThisSortField) as sort expression in your chart.

Restricting the user to always select only one value from this list you allow him to choose the sort order.

Anonymous
Not applicable
Author

Thanks.

I still have a problem with making a table with sort expressions and then pick them up in the chart sort order.

I have made an inline table with the value:

Expression, Sort

"fractile(Sallary, 0.10)", P10

And in my chart i did like you worte, in the expression for sort order i put =$(Expression)

nothing happend. If a make a textbox with the Expression =$(Expression) nothing comes up. I've also tride just =Expression and in the texbox everything seem fine but not in the sort order. I've also tried =concat(Expression) that aslo work for the textbox but still nothing in the chart sort order.

Any ideas what i'm doing wrong?

Thanks again

whiteline
Master II
Master II

Hi.

First, try remove quates and use $(=Expression)  as sort expression.

Of course there should be only one Expression selected.

Anonymous
Not applicable
Author

Works perfect now! Thanks alot! really appreciate it!