Skip to main content
Skip table of contents

ENUM

Category: Filtering & data shaping

Overview

Description

Iterates through the rows of the input and assigns a number to each row in ascending or descending order based on the magnitude of measures.

Use this when you need to assign sequential numbers (ranks) to rows based on their values, for example to build threshold rules or select the top/bottom N items.

Syntax

ENUM('Node' [, "Order"])

Parameters

  • Node: An input node with rows to be enumerated.

  • Order (optional): Whether to enumerate in ascending or descending order.

    • "ASC" - The row with the smallest measure is assigned the number 1 and increases as the measures increase. This is the default.

    • "DESC" - The row with the largest measure value is assigned number 1 and increases as the measures decrease.

Limitations

  • In case of rows having the same value, the tie breaking is done by looking at the level values.

  • The priority during tie breaking is determined by the alphabetical order of the dimension names and the hierarchy of levels within those dimensions.


Examples

Enumeration by measure value (ASC and DESC)

This example shows how ENUM ranks rows by their values, first in ascending order (default), then in descending order.

Input node: Node A

Year

Value

2025

7

2026

5

2027

3

2028

-2

Formula: ENUM('Node A')

Year

→ ENUM Result

2025

4

2026

3

2027

2

2028

1

Formula: ENUM('Node A', "DESC")

Produces the enumerated result starting from the largest measure value.

Year

→ ENUM Result

2025

1

2026

2

2027

3

2028

4

Tie-breaking with multiple dimensions

When rows share the same measure value, ENUM breaks ties using dimension levels in alphabetical order of dimension names and hierarchy within each dimension.

Dimensions & Levels:

Time → Year

Product Dimension → Product Family, Product

Input node: Node B

Year

Product Family

Product

Value

2025

Car

Big Car

6

2026

Truck

Big Truck

-5

2027

Car

Small Car

-5

2028

Truck

Small Truck

9

Formula: ENUM('Node B')

Year

Product Family

Product

→ ENUM Result

2025

Car

Big Car

3

2026

Truck

Big Truck

2

2027

Car

Small Car

1

2028

Truck

Small Truck

4

In this case enumeration starts from lowest measure which is -5 which there is a tie on two rows. Function “prioritises” Product dimension over "Time" since the name is alphabetically appearing earlier. Within the product dimension "Product Family" is the upper level in hierarchy that is why this level is used to break the tie and the row with the "Car" gets the first value over "Truck". There is no other tie in the measures so enumeration continues as usual for the rest of the rows.

Input node: Node C

Year

Product Family

Product

Value

2025

Car

Big Car

-5

2026

Truck

Big Truck

-5

2027

Car

Small Car

-5

2028

Truck

Small Truck

-5

2029

Car

Small Car

-5

Formula: ENUM('Node C')

Year

Product Family

Product

→ ENUM Result

2025

Car

Big Car

1

2026

Truck

Big Truck

4

2027

Car

Small Car

2

2028

Truck

Small Truck

5

2029

Car

Small Car

3

In this more complex case every measure is equal. As mentioned in the previous example the level "Product Family" is prioritised to break the tie however there is a another tie as rows 1, 3, and 5 are all sharing the same value "Car". In this case the function looks at the next available level in dimension which is "Product" and the row with the "Big Car" is enumerated with value 1. Row 3 and 5 still share the same value "Small Car" which in this case the function will look at the Time dimension "Year" to resolve the final conflict.


Related Functions

Function

When to use instead

ENUM_LEVEL

When you want to enumerate by the order of level values in dimension management rather than by measure value.

FINDFIRST

When you want to select one value per group rather than assign ranking numbers.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.