Enrichment with ranking
Function¶
The Enrichment with Ranking operation allows you to enrich a field in a target dataset with a rank value calculated within sections defined by one or more attributes. The records will be sorted according to the chosen criterion.
On the transaction definition page, you must specify:
- Target Field: the field which is enriched with ranking values.
-
Ranking type: allows you to select a type of ranking:
-
Differentiate sorting: corresponds to the ROW_NUMBER function. The ranking number is incremented for each record in the section that has the same values in the fields defined by the sorting criteria The rank value is initialised for each section.
- Keep sorting: corresponds to the DENSE_RANK function. The same ranking value is assigned to records within the same section that have identical values in the fields defined by the sorting criteria. The ranking value is increased for each section.
- Sorting rules: free field where you can specify the sorting criteria of the operation.
Note: If no key fields are specified, the system will only apply the sorting criteria to calculate the ranking.
Note: If the sort criteria are not specified, the system will sort the data using all custom fields, following the natural sorting of the table, excluding the target field. If the target field is to be included, the user must add it manually.
Note: If a filter is used in the operation on the dataset, enrichment and sorting will only be applied to the data selected by the filter.
Example
| Category | Product | Price | Rank |
|---|---|---|---|
| X | AA | 100 | 1 |
| X | B | 100 | 2 |
| X | C | 200 | 3 |
| Y | D | 200 | 1 |
| Y | E | 200 | 2 |
| Y | F | 300 | 3 |
Target field: Ranking
Ranking type: Differentiate sorting
Sorting criteria: Price
Key fields: Category