Skip to main content
Skip table of contents

ENUM

Basic 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. Order: Allowed values are "ASC" for ascending and "DESC" for descending.

Signature

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

Parameters

  • Node: An input node with rows to be enumerated

  • Order: Whether to enumerate in ascending or descending order. Valid values are:

    • ASC(default): The row with the smallest measure is assigned the number 1 and increases as the measures increase.

      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.

Example 1:

Input:

Node A

Year

Measure

2021

7

2022

5

2023

3

2024

-2

Applying ENUM('Node A') will simply produce the following. Here enumerating is done only based on measures.

Year

Measure

2021

4

2022

3

2023

2

2024

1

Applying ENUM('Node A', “DESC“) will produce the enumerated result starting from largest measure value.

Year

Measure

2021

1

2022

2

2023

3

2024

4

Example 2:

Dimensions & Levels:

Time → Year

Product Dimension → Product Family, Product

Input:

Node B:

Year

Product Family

Product

Measure

2021

Car

Big Car

6

2022

Truck

Big Truck

-5

2023

Car

Small Car

-5

2024

Truck

Small Truck

9

Applying ENUM('Node B') would yield:

Year

Product Family

Product

Measure

2021

Car

Big Car

3

2022

Truck

Big Truck

2

2023

Car

Small Car

1

2024

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 C:

Year

Product Family

Product

Measure

2021

Car

Big Car

-5

2022

Truck

Big Truck

-5

2023

Car

Small Car

-5

2024

Truck

Small Truck

-5

2025

Car

Small Car

-5

Applying ENUM('Node C') would yield:

Year

Product Family

Product

Measure

2021

Car

Big Car

1

2022

Truck

Big Truck

4

2023

Car

Small Car

2

2024

Truck

Small Truck

5

2025

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.

JavaScript errors detected

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

If this problem persists, please contact our support.