enum function
The Enum function enumerates the rows in a dataset, in ascending order, optionally grouped by a selected attribute.
Parameters
enum(group)
Parameter | Description |
---|---|
group | If provided, each row will be numbered according to the value of the specified column. More than one column can be specified for grouping, as long as all columns are contained in double brackets, e.g. enum((column1, column2)). If no parameters are specified, a unique number for each row in the dataset, in ascending order, will be provided. |
Example - enum()
The following example uses the Bike sales dataset.
Description | Screenshot |
---|---|
In this first example here, we have simply configured the enum attribute to enumerate all the rows in the dataset, in ascending order, with the formula |
Example - enum(group)
The following example uses the Bike Sales dataset.
Description | Screenshot |
---|---|
In the second example, we will enumerate each row in the dataset, in ascending order, according to the value of the month attribute, by defining the enum attribute with the following formula There is a separate enumeration for each distinct value of the Month attribute. So the enumeration restarts at line 3, as the Month value changes to March, and so on. |
Example - enum((column1, column2))
The following example uses the Bike sales dataset.
Description | Screenshot |
---|---|
In the final example, we want to enumerate each row in the dataset, in ascending order, according to two attributes, Month and Year, by defining the enum attribute with the formula There is a separate enumeration for each distinct value of the Month attribute, AND each distinct value of the Year attribute. It is important to enclose the attributes in double brackets, to specify that both attributes need to be considered within the column parameter. |