Qlik Community

QlikView Documents

Documents for QlikView related information.

Custom sort order in chart

New Contributor III

Custom sort order in chart

This app simulates how the sort order in a chart can be governed by a user option.

Recognised use cases for custom sort orders in charts include:

1. Managing the sort order of charts through chart properties without need for script change and refresh

2. User customisable sort order of dimension values (self service propositions)

3. Setting priority sort orders for subset of dimension values whilst retaining freedom to sort non-priority items by other logic

4. Varying sort order according to audience (e.g. multi-customer applications, where logged in customer wants to see their performance consistently presented at the top / first)

Labels (1)

Thanks for sharing

Nice one Jonas..

Valued Contributor

Looks good Jonas, this was exactly what I was looking for. I'm was a bit concerned that you have copyrighted it. Can you let me know if I am able to use this expression in my applications without recourse?

Many thanks


New Contributor III

Hi Richard,

No worries - just don't take the actual qvw I've produced and sell it on as training please, that is what the copyright is there to prevent.

The syntax tips and learnings are free for everyone to reuse / enrich / repurpose any way they like - I intend to share a lot more like this future wise. Any reference back to the author of particularly useful nuggets is of course appreciated but not mandatory.

Happy implementing!



Jonas Valleskog

Senior Consultant

Mob: +44 (0)7446 144 572

Tel: +44 (0) 208 100 6515


Context Business Intelligence Ltd

Parkshot House, 5, Kew Road, Richmond, Surrey, United Kingdom, TW9 2PR

Valued Contributor


Here's a couple more examples of changing chart "sort" orders, these work with expressions:





I think these would be more efficient and easy to understand sort expressions for the two charts, respectively:

If(Customer='$(vFocusCustomer)', 0, 1)

If(Customer='$(vFocusCustomer)', 0, Rank(Sum(Value)))

New Contributor III

Hi Michael,

In my simplistic example of comparison against a single value, I agree with you - match(...) is over-engineered. With minor tweaks, match(...) allows for setting priority sort for a bundle of values whereby you may have three focus products or competitor brands that you wish to prioritise, not just the one.

Thanks for the feedback, simplification where possible is always good - a hunch tells me your version will more often than not be sufficient to meet client needs.


Jonas Valleskog The example is very useful. Thanks for sharing.

Honored Contributor

Good info. Thanks for sharing.

Version history
Revision #:
1 of 1
Last update:
‎04-29-2014 07:41 PM
Updated by: