> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sort data

> How to sort tables and charts in Atoti UI by hierarchy or measure using the Sort ascendingly and Sort descendingly context menu options, covering breaking vs. non-breaking sort behavior for pivot table, tree table, and table widgets, and how to order members manually by dragging and dropping their column.

Atoti UI provides the ability to sort your data by a chosen [**hierarchy**](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/user-guide/navigate-atoti-ui/data-model.md#hierarchy) or [**measure**](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/user-guide/navigate-atoti-ui/data-model.md#measure).

> [!NOTE]
>
> The ability to sort data relies on a series of plugins. If you cannot find
> them in your application, contact your system administrator.

## Sort a table

To sort a table:

1. Right-click on the header of the column you want to sort.
2. Select either **Sort ascendingly** or **Sort descendingly** from the context menu.

Once a sort has been applied, there will be an icon in the header of the sorted column. Clicking this icon will change the sort from ascending to descending, or vice versa.

![The City column is sorted descendingly by right-clicking its header. The
delta.SUM column is then sorted ascendingly from its header, removing the City
sort. Clicking the sort icon in the delta.SUM header toggles it to
descending.](https://mintcdn.com/activeviam/6HeHK8nCkGvZilsK/data-visualization/atoti-ui/5.2/static/img/user-guide/analyze-data/sort-data/sort-table.gif?s=2e0e834ef3c308ce29ac5204d6164884)

> [!NOTE]
>
> **Pivot table** and **Tree table** widgets have a non-breaking sort, whereas **Table** widgets have a breaking sort.
>
> See the [Microsoft documentation](https://learn.microsoft.com/en-us/sql/mdx/order-mdx?view=sql-server-ver15) to learn more about the difference between a breaking and non-breaking sort.

## Sort a chart

To sort a chart:

1. Right click anywhere on the chart.
2. Select either **Sort ascendingly** or **Sort descendingly** from the context menu.
3. A second menu will appear where you can select the measure or hierarchy to sort on.

![A line chart is right-clicked to open the sort context menu. Hovering Sort
ascendingly or Sort descendingly reveals a submenu of measures and hierarchies
to sort on. A selection is made and the chart
reorders.](https://mintcdn.com/activeviam/6HeHK8nCkGvZilsK/data-visualization/atoti-ui/5.2/static/img/user-guide/analyze-data/sort-data/sort-chart.gif?s=ce4752a1191c4abd091d4286eae678be)

## Reorder members manually

The members displayed in the columns of a [table widget](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/user-guide/create-a-dashboard/widgets/about-widgets.md#tables-for-aggregated-data) can also be ordered manually, without sorting on a measure or a hierarchy.

1. Click the header cell of the member to move.
   The cell becomes the only selected one, and a drag handle appears along its left edge.
2. Click the cell again and hold it, drag it to the left or to the right, then drop it at the desired location.
   A vertical line marks where the column will land.

The measures displayed as columns can be moved the same way.

![A column header cell is selected and displays a drag handle along its left
edge](https://mintcdn.com/activeviam/6HeHK8nCkGvZilsK/data-visualization/atoti-ui/5.2/static/img/user-guide/analyze-data/sort-data/member-drag-handle.png?fit=max\&auto=format\&n=6HeHK8nCkGvZilsK\&q=85\&s=015bb18e61c409f3cfd2ead09aa6b591)

![A column is being dragged, and a vertical line marks where it will
land](https://mintcdn.com/activeviam/6HeHK8nCkGvZilsK/data-visualization/atoti-ui/5.2/static/img/user-guide/analyze-data/sort-data/member-drag-in-progress.png?fit=max\&auto=format\&n=6HeHK8nCkGvZilsK\&q=85\&s=15a197859c42e66a20743f590246c9d7)

This positions a member among its siblings, within its parent in its [hierarchy](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/user-guide/navigate-atoti-ui/data-model.md#hierarchy):

* A member always keeps its parent.
* When several hierarchies are displayed on the same axis, the members of the hierarchies below stay grouped under the member of the hierarchy above they belong to.
  The hierarchy cannot be broken by moving such a member out of its parent.
* Totals and subtotals cannot be moved.

> [!NOTE]
>
> Manual ordering is unavailable when the dataset is too large to be loaded at
> once.

> [!TIP]
>
> Though only tables offer this drag and drop, all the widget types honor it.
> So, to order the members displayed by a chart, [switch the widget
> type](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/user-guide/create-a-dashboard/widgets/add-or-modify-widgets.md#switch-widget-type)
> to **Pivot table**, reorder the columns, then switch the widget back to the
> chart.

> [!TIP]
>
> The members displayed in the rows of a table cannot be ordered manually
> either. To order them, [move the
> hierarchy](https://docs.activeviam.com/data-visualization/atoti-ui/5.2/user-guide/create-a-dashboard/widgets/add-fields.md) from the **Rows** section
> to the **Columns** section of the **Fields** tab, reorder the columns, then
> move the hierarchy back to the **Rows** section. The rows honor the resulting
> order.

## Remove sort

The process to remove a sort is the same for all types of widgets.

1. Right-click anywhere on the widget to open the context menu.
2. Select **Remove sort**.

![A pivot table is sorted descendingly by right-clicking and selecting Sort
descendingly. It is then right-clicked again and Remove sort is selected,
returning the rows to their default
order.](https://mintcdn.com/activeviam/6HeHK8nCkGvZilsK/data-visualization/atoti-ui/5.2/static/img/user-guide/analyze-data/sort-data/remove-sort.gif?s=5caa4517d1395a2b6a2b2ae0b15926b6)

> [!NOTE]
>
> The **Remove sort** menu item only appears if the widget is currently sorted
> or has manually ordered members. It removes both.
