---
title: Sort column
description: Sort dataset rows by one or more columns with configurable sort order.
category: Data Transformation
tags: [sort, column, order, arrange, data processing]
---

# Sort column

## Description

The **Sort Column** activity allows you to sort the rows of a dataset based on one or more selected columns. You can define multiple sorting rules — each specifying the column and the desired order (ascending or descending). This activity is helpful for organizing, prioritizing, or ranking data before presentation or further processing.

Use this activity to:

- Sort products by rating or price
- Prioritize entries based on scores or status
- Prepare reports with consistent ordering

> **Use case**:  
> After retrieving a list of products with ratings, prices, and discounts, you can sort them first by rating (descending), and then by discount percentage (descending) to find the best deals.

## Input

| Type     | Description                                                           |
| -------- | --------------------------------------------------------------------- |
| **Data** | Input table from a previous activity containing columns to be sorted. |

## Output

| Type     | Description                                     |
| -------- | ----------------------------------------------- |
| **Data** | Sorted dataset based on provided configuration. |

## Configuration Fields

| Field Name     | Description                                                                                                                               |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| **Column Map** | A list of sorting rules, each defining:<br>• **Column** – Name of the column to sort by<br>• **Sort Order** – `Ascending` or `Descending` |

> Multiple sort rules are applied in the order defined — the first rule is the primary sort, the second is secondary, and so on.

## Sample Input

| product_id | rating | discount_percentage | price  |
| ---------- | ------ | ------------------- | ------ |
| B07JW9H4J1 | 4.2    | 64%                 | ₹399   |
| B07AB2CD34 | 4.5    | 50%                 | ₹1,499 |
| B07XY1MN67 | 4.5    | 70%                 | ₹999   |
| B07EF3PL88 | 3.9    | 55%                 | ₹799   |

## Sample Configuration

| Column              | Sort Order |
| ------------------- | ---------- |
| rating              | Descending |
| discount_percentage | Descending |

## Sample Output

| product_id | rating | discount_percentage | price  |
| ---------- | ------ | ------------------- | ------ |
| B07XY1MN67 | 4.5    | 70%                 | ₹999   |
| B07AB2CD34 | 4.5    | 50%                 | ₹1,499 |
| B07JW9H4J1 | 4.2    | 64%                 | ₹399   |
| B07EF3PL88 | 3.9    | 55%                 | ₹799   |

> Rows are sorted first by `rating` (highest to lowest), and then by `discount_percentage` in descending order for matching ratings.
