INDEX_ORDER
Applies to: CELONIS 4.6
Description
INDEX_ORDER
returns a column with INTEGER indices, starting from 1
. The indices indicate the order of the rows, if the input table values had been sorted.
The INDEX_ORDER
function creates an INTEGER index column. The index column contains a unique INTEGER value for every row of a required reference input column. The values of the indices are based on the order of the values in the input column.
INDEX_ORDER
can be applied to INT, FLOAT, DATE or STRING columns. The result is a column of type INTEGER.
Syntax
INDEX_ORDER( column [, sorting ] [, GROUP( group_column, ... ) ] )
column: The source column on which the index column will be based.
sorting: An optional sorting of the indices, which defaults to ascending.
ASC: Ascending index order values.
DESC: Descending index order values.
grouping: Optional grouping columns. Independent index order ranges will be created for each group, all starting from 1.
Ordering
Ordering can be ascending (default) or descending. Indices are counted from 1. Equal input values are always given distinct output indices. The indices for a given range of equal input values are incremented starting from the topmost value of this range of the input column:
[1] Create an index order for an input column that contains equal values. |
The above behavior also holds for descending ordering of indices.
Null handling
Null values are ignored, meaning that the null value rows stay null in the result column and will count as an index order value.
Examples
[4] Create an index order for an integer input column. |
[5] Create an index order for a date input column. |
[6] Create an index order for an input column in ascending order. |
[7] Create an index order with a joined case table.
|
[8] Create an index order on an aggregation function.
|
[9] Create an index order for a date input column with equal values. |
[10] Create an index order for a string input column with a function. |
[11] Create an descending index order for an integer input column that includes NULL values. |
[12] Create an index order for each group.
|
[13] Create an index order for each group, as given by more columns.
|
Advanced Example: Case Coverage
The INDEX_ORDER
function allows to calculate KPIs, that require sorting. One example is calculating how many cases are covered by the N most common process variants.
[14] Given two cities, we want to find out how many cases are covered by the two most common variants for each city. Let us first look at the process variants.
|
[15] In this step we add:
|
[16] Finally we want to report the fraction of cases which are covered by the two most common process variants, per city. To calculate the fraction, we use the PU_COUNT function to count cases per city:
|