In Multidimensional Expressions (MDX), the following statements are used to manage context, scope, and flow control in an MDX script.
Theme |
Description |
Calculate Statements |
Calculate subcube, and also determine the solve order contained in a subcube |
Case Statement |
Allow conditional return of a specific value from multiple comparisons |
existing Keywords |
Forces the specified set to be evaluated in the current context |
Freeze Statements |
Locks the cell value of the specified subcube to its current value |
if statement |
If the condition is true, the statement is executed |
Scope Statement |
Restricts the scope of the specified MDX statement to the specified subcube |
Example:
Suppose there is a set of metrics: the "Act", "Qof", and "AOP" values of the original indicator, which is the sum of these measures themselves.
However, for a dimension metric "service group rollover rate", the three measures are calculated as "service Group Rollover" (indicator code 205)/service group average incumbency (indicator code 24).
Now use the scope script to achieve these features:
Scope
(
{
[Measures]. [KPI ACT]
, [Measures]. [KPI q0f]
, [Measures]. [KPI AOP]
, [Measures]. [Forcast]
}
)
[KPI]. [KPI Hierarchy]. [Kpi].&[209]=iif
(
[KPI]. [KPI Hierarchy]. [Kpi].&[24]=0
Null
, [KPI]. [KPI Hierarchy]. [KPI].&[205]/[KPI]. [KPI Hierarchy]. [Kpi].&[24]
)
End Scope
Thus, if the value of the "act" of the Indicator "service group rollover rate" is used in the future, its value is not directly referring to the values of the "act" field, but rather the values derived from the above calculation formula.
Attached: Scripting syntax
Subcube_expression:: = (Auxiliary_subcube [, Auxiliary_subcube,... N])
Auxiliary_subcube:: =
Limited_set
| Root ([dimension_name])
| Leaves ([dimension_name])
Limited_set:: =
Single_tuple
| Member
| Common_grain_members
| Hierarchy.members
| Level.members
| {}
| Descendants
(
Member
, [Level
[
, self
| After
| Before
| Self_and_after
| Self_and_before
| Self_before_after
| LEAVES
]
)
[* <limited Set>]
MDX Script Statement--Scope