Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
rvijayanth
Creator
Creator

Need help with sorting using expression

I have ONE chart with variable dimension and corresponding counts. Based on a variable this chart will show counts for (Sex) or (Insurance)

If variable 1 is selected, the chart will be as follows: Note: (Sorting is based on ascending order of Sex column)

Sex            Count

Female      12

Male          24

Unknown   2

Total          38

If variable 2 is selected, the chart will be as follows: Note: (Sorting is based on Descending order of Count)

Insurance          Count

Insurance 2       20

Insurance 1       11

Insurance 3       7

Total                 38


Please help me accomplish this using expression

4 Replies
MK9885
Master II
Master II

Use these 2 expressions for each dimensions in Sorting Tab (sort by expression)

For S**: aggr(Yourexpression, S**)

For Insurance: aggr(Yourexpression, Insurance)

And then adjust the expression sorting to Ascending or Descending as per your view.

sunny_talwar
MVP
MVP

Dimension itself is changing based on selection of a variable?

rvijayanth
Creator
Creator
Author

Yes

sunny_talwar
MVP
MVP

Would you be able to share a sample where you are trying this?