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!
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)
is this?
Hi Chanty, in your file, the bars are sorted by Country but they are not sorted by Value as a secondary sort. The final look of the graph would have the bars in this order:
FF (Canada-1000) - BB (Canada-500) - DD (Canada-400) - EE (USA-300) - CC (USA-250) - AA (USA-150)
can you try this
First create the Sort Table
Sort:
LOAD distinct Country,
Autonumber(Country) as SortCountry
Resident YourTable
Order by Country desc;
Now go to chart Properties-Sort Tab-> Check expression -> Descending put below condition
=SortCountry & YourExpression
Hello Mark,
Go to Chart Properties -> Sort Tab
- Make sure the Sort list is right (1st Country, 2nd Value)
- Sort Country A-Z
- Sort Value Numeric Descending
Hi Mark,
Try sort expression as
=Sum(Value)&Ord(Location)
Attached the updated file.
maybe this ! !
This actually achieved the desired sort order by chance. But it is not working well. For one thing, the expression does not consider the Country.
It should sort by Country first
THEN
sort by Sum(Value)
Yes, the straight table you have is correctly sorted into the desired order but how do you translate that same order onto the bar graph?
Tried and yes this looks good! Quick question, is there an alternative way of achieving this from within the bar chart only and without having to use the Load Script?