Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
This may look like a simple task but I can't seem to do it properly. Most of the materials I've found so far here are on custom sorts, but nothing on multilevel sort. Essentially, I want my bar chart to sort first by Country (Descending A>Z) then by Value (Descending).
Sample table below and I have attached the qvw file with the bar chart.
Location | Country | Value |
---|---|---|
AA | USA | 150 |
BB | Canada | 500 |
CC | USA | 250 |
DD | Canada | 400 |
EE | USA | 300 |
FF | Canada | 1000 |
Hoping for any advice. Thanks!
try this
Good approach and considered this earlier. I failed to mention that I can't change the look and feel of the chart. X-axis should always just be the Location.
How about this for the sorting expression:
Ord(Country) * 10000 - Sum(Value)
Giving higher weight to Country by multiplying it by 10000 and then subtracting Sum(Value)
The number to be multiplied with will depend on the max value of Sum(Value). You would want the 10,000 in my example to be bigger than the max value of Sum(Value). In our case the max was 1000 so I randomly picked 10000. But if in your actual scenario the max(value) is 600000000, I would multiply by 1000000000.
I guess a better image with slight modification of data
You can try the way suggested by others as alternative. But doing so in script will keep the things well structured rather than going for complex expressions.
according to the sort tab we can sort is possible
Yes. I didn't notice it properly. You can use Sunny's solution. But you no need to enter the multiplied value manually. Instead you can use below expression.
Ord(Country) * Max(Total Aggr(Sum(Value),Location)) - Sum(Value)