Skip to main content

Data Sorting

1. Overview

1.1. Application Scenarios

If you want the fields in the chart to be presented in a certain order to more intuitively display numerical changes, you need to sort dimension or measure fields.

1.2. Function Introduction

Data sorting supports ascending/descending order, custom sorting, field sorting and alphabetical sorting.

It supports dragging and adding multiple sorting conditions at the same time. When multiple sorts exist, the sorting rules in the sorting area take effect from top to bottom in order. In addition to supporting sorting for text, date, and numerical fields, it also supports sorting based on newly created calculated fields, fields with aggregation methods set, or grouped fields.

When dynamic dimensions exist, sorting rules dynamically take effect according to the actual display fields of the chart. Example:

  • If the current chart displays dimension as field A, only field A's sorting rule takes effect, B/C rules are automatically ignored.
  • If the chart switches to field B, only field B's rule takes effect, A/C rules are automatically ignored.

2. Operation Steps

2.1. Ascending/Descending Order

The sorting rules for ascending/descending order are as follows:

  • For text type fields: For extracted databases, sort by ASCII code in ascending/descending order; for direct connection databases, sort according to the default sorting syntax in the database.

  • For date type fields: Sort by date order from early to late (ascending) or from late to early (descending).

  • For numerical type fields: Sort by numerical size from small to large (ascending) or from large to small (descending).

The following example demonstrates the operation steps for sorting "Sales Revenue" in descending order.

  1. In the drawing area, drag the fields that need to be displayed into the dimension and measure areas respectively.

  2. Drag the field "Sales Revenue" that needs to be sorted into the "Sorting" area.

  3. Click on "Sales Revenue", select "Descending" in the dropdown box, and view the sorting effect.

rank-01

2.2. Custom Sorting

When ordinary ascending/descending order cannot meet requirements and you want dimensions to be displayed in a self-defined order, you can use custom sorting.

The following example demonstrates the operation steps for custom sorting by "Customer Category".

  1. In the drawing area, drag the fields that need to be displayed into the dimension and measure areas respectively.

  2. Drag the field "Customer Category" that needs to be sorted into the "Sorting" area.

  3. Click on "Customer Category", select "Custom Sorting" in the dropdown box, and configure the desired display order in the popup. It supports two methods: drag sorting and batch paste. Drag sorting adjusts the order by manually dragging, and batch paste defines the order by pasting text.

For example, in the figure below, to display customer categories according to customer level from high to low, manual custom sorting is performed.

rank-02

2.3. Field Sorting

For scenarios with many dimension values and frequent order changes, manually dragging through custom sorting is cumbersome, and maintenance is inconvenient when order changes, making it prone to errors. At this time, you can maintain a code column to determine the order of that dimension, that is, achieve it through field sorting.

Note: Only dimension fields can be configured. When the field used for sorting is a measure field, only aggregation method of no processing is supported.

For example, a company has hundreds of stores nationwide and hundreds of categories, and stores and categories will be added or removed over time. Now we want to display according to specific store order and category order. At this time, we can maintain code columns and use field sorting to achieve this. The following demonstrates the operation steps with a specific example. Example dataset Store Product Category Dataset.

  1. In the drawing area, drag the fields that need to be displayed into the dimension and measure areas respectively.

  2. Drag the "Store" field into the "Sorting" area, click on "Store", select "Field Sorting", and select "Store Code" in field sorting, with sorting method as "Ascending" (as shown in the figure). After configuration, the "Store" field will be sorted according to the "Store Code" field.

    rank-03

  3. Following the previous step, set the "Category" field to be sorted according to the "Category Code" field. After completion, view the sorting effect.

    rank-04

2.4. Alphabetical Sorting

For text fields, ascending/descending order sorts by ASCII code; if you need to sort by first letter in ascending/descending order, you need to enable alphabetical sorting. After alphabetical sorting is enabled, it takes effect for all ascending/descending order arrangements in the entire sorting area: ascending order sorts by first letter a-z, descending order sorts by first letter z-a.

Note: Only extracted databases support alphabetical sorting, direct connection databases do not support yet. The following demonstrates the operation steps with an example of alphabetical sorting by "Product Category".

  1. In the drawing area, drag the fields that need to be displayed into the dimension and measure areas respectively.

  2. Drag the field "Product Category" that needs to be sorted into the "Sorting" area.

  3. Click the icon after "Sorting" and check "Alphabetical Sorting" (as shown in the figure). Click on "Product Category", select "Ascending/Descending" in the dropdown box, and view the alphabetical sorting effect.

rank-05