Skip to main content
Skip table of contents

ENUM_LEVEL

Basic Overview

Description

Iterates through the values of the specified levels and returns each value with a number assigned in ascending or descending order according to the sequence in the dimension management. Order: Allowed values are "ASC" for ascending and "DESC" for descending.

Signature

ENUM_LEVEL(“Level1” [, “Level2”, ...] [, Order])

Parameters

  • Level: Level(s) at which their values are 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

  • If multiple levels are passed to the function, the alphabetical order of the dimension name and the hierarchy of levels within that dimension will determine which level takes precedence in the event of a tie.

Example 1:

ENUM_LEVEL(“Year“) will produce:

Year

Measure

2021

1

2022

2

2023

3

2024

4

ENUM_LEVEL(“Year“, “DESC“) will produce:

Year

Measure

2021

4

2022

3

2023

2

2024

1

Example 2:

Dimensions:

Time → Year

Location → Country

ENUM_LEVEL(“Year“, “Country“) will produce:

Year

Country

Measure

2021

France

1

2022

France

2

2023

France

3

2024

France

4

2021

Germany

5

2022

Germany

6

2023

Germany

7

2024

Germany

8

In this example “Location” dimension is prioritised over “Time“ which starts enumeration with rows having value “France” over “Germany“. Within the rows having same value, the “Year” level is used to further break the tie.

JavaScript errors detected

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

If this problem persists, please contact our support.