Sorting Legend Out of Order

Hi,

I would like to sort my legend out of the typical descending or ascending order. How might I do this in the example below. I want 100+ to show after 50-100. Maybe a calculated field can be used for this?

Hi @asdf1

To sort a legend in a custom order such as ensuring 100+ appears after 50-100. create a calculated field to assign a numeric or string rank to each legend value and then sort your legend by this field.

Example:

ifelse(
{REPORT_USAGE_BUCKETS} = '0-10', 1,
{REPORT_USAGE_BUCKETS} = '10-25', 2,
{REPORT_USAGE_BUCKETS} = '25-50', 3,
{REPORT_USAGE_BUCKETS} = '50-100', 4,
{REPORT_USAGE_BUCKETS} = '100+', 5,
NULL
)
1 Like

@Xclipse thanks for the reply!

I have created the calculated field, but it is not clear how sort by this field without including it in the visual, which I do not want to do.

Hi @asdf1

Add the newly created calculated field to the group/color section of the vertical stacked bar chart. It will be sorted in ascending order by default.

Hi @Xclipse

putting this field into the group/color section changes the visual in a way that I do not want to do. Is there a way to sort without changing my visual?

i was able to hack this together by adding blank spaces before the legend values