Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
ymcmb
Contributor III
Contributor III

Expression to control multiple sorting

I am using a nested IF statement to control my sorting on a table. When a user selects a specific department value from the filter pane, I want my table to show the specific employees tied to that table. 

I have set up 3 separate variables to control my pick and match function.

Example - pick(match(Employees, 'Jason', 'Josh'), 1 2) for Marketing. pick(match(Employees, 'Abram', 'Jenny'), 1 2)

if ( [Department] = 'Marketing',  $(vSORTmarketing),

   if ( [Department] = 'Finance', $(vSORTfinance))

This doesn't seem to control any sorting for me. Also, if I am sorting my expression, does the other sorting options (sort by #, sort by alphabetical) create issues with sorting as expression? 

 

Labels (2)
2 Replies
marcus_sommer

In general such sorting-expressions should work but they must be enabled within the object and will then exclude other sorting-options. Beside this the use of calculated dimensions with aggr() or applying rowno() could have an impact on the sorting.

At first you should try if your logic really worked by using the real expression within the sorting and not variables. If this worked and not with the variables it means that the variables are wrongly created and/or called and would need to be adjusted.

- Marcus

ymcmb
Contributor III
Contributor III
Author

I was able to get it working by removing the pick function within my match formula. For some reason, Qlik doesn't like the mix and matches of both when sorting by expression.