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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort by Y-Axis programmatically

Hi -

I am building a stacked bar-chart with a user toggle between sort-alphabetically and sort-by-total descending.  The problem is when the Y-axis has multiple elements then this sort statement ...

=if(vSortByCaption='Name',vXAxis_col,-1 * $(=vFormula))

... results in a sort by the largest single Y element, not the Y total.; but if I turn on "Sort by Y-Axis" then I lose the ability to sort alphabetically.  See attached screenshot below.

Is there a better way to code the sort expression or else to programatically toggle the "Sort by Y-Axis" checkbox?

Thank you

Sort-by-value.PNG.png

1 Reply
maxgro
MVP
MVP

if I understand your question you can try to sort by

aggr(sum(Value), MonthData)

where Value is expression and MonthData is your first dimension

see attachment