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 |
|
Limitations |
|
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.