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

Announcements
Share your agentic AI experience, learn from others, and earn a new badge: Put Agentic AI to Work
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort chart y-axis descending

Hi

Can anyone tell me, how to sort y-axis descending in a scatter chart ?

Best regards,

Jerrik

Labels (1)
3 Replies
johnw
Champion III
Champion III

One way would be to set a static min = max of your data, and static max = min of your data. There might be an easier way, but it isn't jumping out at me.

Not applicable
Author

It works! And min and max could be calculated on the fly.

But unfortunately it does not solve the hole case. I did not write, that I have 3 expressions in a group, so min and max calculation is not an option.

Regards

Jerrik

johnw
Champion III
Champion III

OK, so you're using an expression group with three expressions. The different expressions would need to result in different minimums and maximums. But you can't set it up that way, because there's no way to refer to the currently-selected expression in the min and max expressions. Correct?

This might be more work than you wanted, and it really seems like just sorting the y-axis correctly should be simpler than all this, but I think you can still make it work.

Let's say your expressions are Revenue, Cost and Margin. Add Revenue, Cost and Margin as dummy fields on their own one-row dummy table in the script if they don't already exist. Combine them into a cyclic group. I think you'd need to build a fake chart with the cyclic group as the dimension, and remove every single thing but the cyclic group, just so you have that control, and can overlay it on your real chart to make it look like an expression group. Combine your three expressions into one with something like this:

pick(match(getcurrentfield(Group),'Revenue','Cost','Margin')
,sum(Revenue)
,sum(Cost)
,sum(Revenue-Cost))

Then for your min expression, use something like this:

pick(match(getcurrentfield(Group),'Revenue','Cost','Margin')
,max(aggr(sum(Revenue) ,Dimension))
,max(aggr(sum(Cost) ,Dimension))
,max(aggr(sum(Revenue-Cost),Dimension)))

And for your max expression, the same thing with min(). I think it would work, even if it's a big headache. I'm hoping that QlikView eventually gives us a function to detect the current expression in an expression group. It would make this a lot easier.