MDX Script Statement--Scope

Source: Internet
Author: User
Tags case statement

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.