# Order by Another Dimension

**URL:** <https://community.holistics.io/t/order-by-another-dimension/634>\
**Category:** Feature Suggestions\
**Created:** [December 30, 2021, 5:35am UTC](https://community.holistics.io/t/order-by-another-dimension/634 "2021-12-30T05:35:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_H](https://community.holistics.io/user_avatar/community.holistics.io/alex_h/32/357_2.png) [@Alex\_H](https://community.holistics.io/u/Alex_H)\
**Post date:** [December 30, 2021, 5:35am UTC](https://community.holistics.io/t/order-by-another-dimension/634/1 "2021-12-30T05:35:10Z")

</div>

It is frequently needed to order dimension elements other than alphabetically. To avoid having to concatenate a numeric field, it would be very useful to be able to specify an “Order By” dimension.

---

<div class="post-metadata">

**Author:** ![Alex\_H](https://community.holistics.io/user_avatar/community.holistics.io/alex_h/32/357_2.png) [@Alex\_H](https://community.holistics.io/u/Alex_H)\
**Post date:** [December 29, 2021, 6:30pm UTC](https://community.holistics.io/t/order-by-another-dimension/634/2 "2021-12-29T18:30:30Z")

</div>

Sometimes it is useful for dimensions to be ordered in a different way to numerical/alphabetical. A separate dimension that is used for ordering which is referenced in the master dimension would then be useful.

---

<div class="post-metadata">

**Author:** ![huy](https://community.holistics.io/user_avatar/community.holistics.io/huy/32/390_2.png) [@huy](https://community.holistics.io/u/huy)\
**Post date:** [December 30, 2021, 2:42pm UTC](https://community.holistics.io/t/order-by-another-dimension/634/3 "2021-12-30T14:42:54Z")

</div>

Hi @Alex_H, I don’t fully understand what you suggested. Do you mean to say:

Sometimes you want to order the values of dimension by a special rule (rather than ASC or DESC). And you suggest to add an attribute to specify this ordering.

A stripped down, non-practical example would be:

```json
dimension some_dim {
   type: 'number'
   order_by: @sql {{ #SOURCE.some_dim }} % 3;;
}

```

In this case the value will be sorted by their remainer of division by 3.

Is this what you have in mind? Do you have a specific example that you could share?

---

<div class="post-metadata">

**Author:** ![Alex\_H](https://community.holistics.io/user_avatar/community.holistics.io/alex_h/32/357_2.png) [@Alex\_H](https://community.holistics.io/u/Alex_H)\
**Post date:** [December 30, 2021, 3:13pm UTC](https://community.holistics.io/t/order-by-another-dimension/634/4 "2021-12-30T15:13:16Z")

</div>

For example I have a text dimension which has the following categories

Category AAA  
Category BBB  
Category CCC

The business needs to consistently present the categories in the following order:

Category BBB  
Category CCC  
Category AAA

Of course we have the option to manually add numbering to the categories

Category 1.BBB  
Category 2.CCC  
Category 3. AAA

But then the numbering is visible everywhere, and may be used in filters. What happens, for example if the company adds category Category DDD which should be displayed between Category CCC and Category Category DDD - any references would be broken.

In a crosstab report, it would be possible to add an indepedent ordering dimension (although this would then take unnecessary space), however in charts there is no ordering dimension.

If we had an ordering dimension, this would be achievable e.g.

```auto
dimension category {
    label: 'Category'
    type: 'text'
    hidden: false
    definition: @sql {{ #SOURCE.CATEGORY }};;
    ordering_dimension: {{ category_order }}
}

dimension category_order {
    label: 'Category Order'
    type: 'number'
    hidden: true
    definition: @sql {{ #SOURCE.CATEGORY_ORDER }};;
}

```

---

<div class="post-metadata">

**Author:** ![anthonytd](https://community.holistics.io/user_avatar/community.holistics.io/anthonytd/32/374_2.png) [@anthonytd](https://community.holistics.io/u/anthonytd)\
**Post date:** [December 30, 2021, 4:07pm UTC](https://community.holistics.io/t/order-by-another-dimension/634/5 "2021-12-30T16:07:31Z")

</div>

Interesting problem, thanks for sharing!

The above approach is something we definitely aim to support in the future, and the scope can be extended to “Order by fields” which will support “Order by measures” as well.

Just sharing, another approach for self-service users is to allow data exploration sorted by columns that are not dragged in the visualization settings.

Let’s say we have the Categories table below

| order | cat | cat\_id |
| --- | --- | --- |
| 1 | Mobile | 132 |
| 2 | PC | 99 |
| 3 | Tablet | 12 |

Then add Category Order to Sort section of Visualization Settings

 ![image](https://community.holistics.io/uploads/default/original/1X/e653554789d9eaabbf13462269bffcb77078bea3.png)

---

<div class="post-metadata">

**Author:** ![Alex\_H](https://community.holistics.io/user_avatar/community.holistics.io/alex_h/32/357_2.png) [@Alex\_H](https://community.holistics.io/u/Alex_H)\
**Post date:** [December 30, 2021, 4:40pm UTC](https://community.holistics.io/t/order-by-another-dimension/634/6 "2021-12-30T16:40:51Z")

</div>

Thanks @anthonytd - great to know it’s on the radar. In the version of Holistics I’m using, it doesn’t allow me to add fields that are not used in the analysis to the order by field. Moreover, ATM order by fields can only be applied to Table and Pivot visualisations.

---

<div class="post-metadata">

**Author:** ![tuan.nguyen](https://community.holistics.io/user_avatar/community.holistics.io/tuan.nguyen/32/442_2.png) [@tuan.nguyen](https://community.holistics.io/u/tuan.nguyen)\
**Post date:** [December 31, 2021, 9:22am UTC](https://community.holistics.io/t/order-by-another-dimension/634/7 "2021-12-31T09:22:10Z")

</div>

Hi Alex,

**1) Sort a field by another field that does not exist in Visualization Settings**  
This feature is already under our radar. I will keep you up-to-date on its progress.

**2) Sort in charts**  
The sorting function in charts might be slightly more hidden than one in Tables and Pivot Tables. You can still sort the chart using the Hamburger menu on the top right corner.

 ![image](https://community.holistics.io/uploads/default/original/1X/649563db3d2d694be5c92c6a8b7abe7c5f413f0c.png)

However, please note that the sort for charts will be applied after row limit is applied (we’ve written extensively about it in this document: [Sorting Data | Holistics Docs](https://docs.holistics.io/docs/data-sort#sort-and-row-limit))

---

<div class="post-metadata">

**Author:** ![olammas](https://community.holistics.io/user_avatar/community.holistics.io/olammas/32/1213_2.png) [@olammas](https://community.holistics.io/u/olammas)\
**Post date:** [September 22, 2023, 7:58pm UTC](https://community.holistics.io/t/order-by-another-dimension/634/8 "2023-09-22T19:58:36Z")

</div>

> [@tuan.nguyen](#):
>
> **1) Sort a field by another field that does not exist in Visualization Settings**  
> This feature is already under our radar. I will keep you up-to-date on its progress.

➕1 on this part of the feature. Especially for table data.

---

<div class="post-metadata">

**Author:** ![gwizard](https://community.holistics.io/user_avatar/community.holistics.io/gwizard/32/1761_2.png) [@gwizard](https://community.holistics.io/u/gwizard)\
**Post date:** [July 22, 2024, 10:02pm UTC](https://community.holistics.io/t/order-by-another-dimension/634/9 "2024-07-22T22:02:57Z")

</div>

Has there been any progress here? Our business has the same issues as stated above.

---

<div class="post-metadata">

**Author:** ![vu.duong](https://community.holistics.io/user_avatar/community.holistics.io/vu.duong/32/483_2.png) [@vu.duong](https://community.holistics.io/u/vu.duong)\
**Post date:** [July 24, 2024, 4:02am UTC](https://community.holistics.io/t/order-by-another-dimension/634/10 "2024-07-24T04:02:53Z")

</div>

Thanks @gwizard for checking in.

Unfortunately there hasn’t been much progress with **Sort a field by another field**. We have been focusing on our As-code Analytics capabilities of late, and had to de-prioritize the Sort improvements.

That said, I’m forwarding it to our team to discuss feasible timeline. Will get back to you if there’s any update.

In the meantime, could you share:

- Do you want to perform this sorting on a Table/Pivot or a chart?
- Could this workaround work for you? - [Customize your sort order of a text column in the table](https://community2.holistics.io/t/customize-your-sort-order-of-a-text-column-in-the-table/659)

---

<div class="post-metadata">

**Author:** ![Alex\_H](https://community.holistics.io/user_avatar/community.holistics.io/alex_h/32/357_2.png) [@Alex\_H](https://community.holistics.io/u/Alex_H)\
**Post date:** [July 24, 2024, 8:59am UTC](https://community.holistics.io/t/order-by-another-dimension/634/11 "2024-07-24T08:59:11Z")

</div>

It would need to be applied any time you sort by that dimension, tables, pivot tables and charts. It would replace the normal sorting of the dimension in all situations.

We have applied that workaround in some situations but it’s not ideal as looks messy and more particularly given what we’ve shared above around any changes in order resulting in issues if reports use filters as the new number order would break filtering.

Definitely a useful feature to have!
