Use MDX for chain search

Source: Internet
Author: User
Tags query relative

This and previous periods are often compared in a report query, such as March sales and February sales. Generally there are absolute and relative value points,
If this period increment = Current period value-the value of the previous period;
Current Period increase = (current period value-previous value)/current period value; relative value
1:MDX this query
With member [Time2]. [This period increment] as ' [time2]. [All Time2]. [1997]. [Q1]. [3]-[time2]. [All Time2]. [1997]. [Q1]. [2] '
Member [Time2]. [Current increase] as ' [time2]. [This period increment]/[time2]. [All Time2]. [1997]. [Q1]. [3] '
Select
{[time2]. [All Time2]. [1997]. [Q1]. [3],[time2]. [All Time2]. [1997]. [Q1]. [2],
[Time2]. [This period increment],[time2]. [Current Increase]} On columns,
{[Measures]. [Store Sales]} On Rows
From Sales
March and February compared to sales increase and increase.
Note: 1 If there is no previous member, the value is 0;
2 MDX provides the PrevMember function to represent the previous member, [All Time2]. [1997]. [Q1]. [2] can be used [all Time2]. [1997]. [Q1]. [3].
PrevMember instead.
2: Solve Order
If more than one calculated member is generated and a calculated member uses another calculated member, the Solve_order is used to indicate the build order
Such as:
With member [Time2]. [This period increment] as ' [time2]. [All Time2]. [1997]. [Q1]. [3]-[time2]. [All Time2]. [1997]. [Q1]. [2] '
, Solve_order = 1,
Member [Time2]. [Current increase] as ' [time2]. [This period increment]/[time2]. [All Time2]. [1997]. [Q1]. [3] '
Solve_order = 2







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.