Custom Sort of X-Axis Values in Bar Graph

Is there a way to customize the order of the x-axis values in the bar chart. For instance in the picture, I want the 25,000 and greater bar to be at the end. The x-axis values are text.

Are those buckets calculated from a different field in your data? If so you can navigate to sort options like so:

image

and sort by the sum of the original field used to calculate the buckets.
image

If those values are coming straight from your data, then create a calculated field like:

ifelse(
x_axis_field = ‘4,999.99 and less’, 1,
x_axis_field = ‘5000 - 9,999.99’, 2,

x_axis_field = ‘25,000 and greater’, 6,
NULL)

and then sort by the max or min of this new calculated field by following the steps above.

**Edit:

You can use switch() instead of ifelse(). It’d look like

switch(
x_axis_field,
‘4,999.99 and less’, 1,
‘5000 - 9,999.99’, 2,

‘25,000 and greater’, 6,
)

Hi @NickP, did this solution work for you? Let us know if this is resolved. And if it is, please help the community by marking his answer as a “Solution.”

1 Like

I’m trying the switch method.

@Steph I’ve tried both the methods mentioned above, but when I sort by the x-axis after creating a calculated field as suggested, it still sorts wrong.

Are you sorting by the Max or Min of the calculated field? On the sort by side panel, after selecting more sort options, you want to select Max or Min from this dropdown:

image

1 Like

Ok, this worked, thanks.