Whenever you have a viz with an X axis, the sort of that axis will always be based on the x axis dimension regardless of how the results are ordered by a measure. However, in some cases you may want to sort the results by a measure like your Top 5 Brands by Inventory Sold.
In those scenarios, there is a quick workaround to achieve the desired sorting order as long as you’re sorting < 10 values (see limitations).
Workaround: Concat the row number with the x axis string
- Insert a new column
- Combine the row number function with your desired X-axis field
- Use this new concatenated field as your X-axis.
- Sort by your desired measure.
Example Implementation
Let’s say you want to look at your Top 5 brands by inventory sold and show some revenue information like Margin and Total sales. In this case a scatter chart is one solution where you sort by Inventory Volume, size by total sales, and color by Margin.
- Sort the results by Total Order Items
- Create a new field called “Top Brands” with formula =
CONCAT(TEXT(ROW(),"00), '. ', A1)
(Note: if you are sorting less than 10 rows you can skip the TEXT() function) - Set Top Brands (rather than Brands) as your X-axis in the chart options
- Drag Total Sales to the size section
- Drag Total Margin to the color section
The result will show numbered countries on the X-axis, sorted by your chosen measure: