saphelp_bpc10_nw_en_4c_33764235c520d4e10000000a42189b_content

5
5/26/2018 saphelp_bpc10_nw_en_4c_33764235c520d4e10000000a42189b_content-slidepdf.com http://slidepdf.com/reader/full/saphelpbpc10nwen4c33764235c520d4e10000000a42189bcontent MDX Formula Syntax PDF download from SAP Help Portal: http://help.sap.com/saphelp_bpc10_nw/helpdata/en/4c/33764235c520d4e10000000a42189b/content.htm Created on April 25, 2014 The documentation may have changed since you downloaded the PDF. You can always find the latest information on SAP Help Portal. Note This PDF document contains the selected topic and its subtopics (max. 150) in the selected structure. Subtopics from other structures are not included. © 2014 SAP AG or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries. Please see www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.  PUBLIC © 2014 SAP AG or an SAP affiliate company. All rights reserved. Page 1 of 5

Upload: melissa-wilson

Post on 15-Oct-2015

6 views

Category:

Documents


0 download

DESCRIPTION

bpc10

TRANSCRIPT

  • MDX Formula SyntaxPDF download from SAP Help Portal:http://help.sap.com/saphelp_bpc10_nw/helpdata/en/4c/33764235c520d4e10000000a42189b/content.htm

    Created on April 25, 2014

    The documentation may have changed since you downloaded the PDF. You can always find the latest information on SAP Help Portal.

    NoteThis PDF document contains the selected topic and its subtopics (max. 150) in the selected structure. Subtopics from other structures are not included.

    2014 SAP AG or an SAP affiliate company. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purposewithout the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AGand its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided bySAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not beliable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the expresswarranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. SAP and otherSAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and othercountries. Please see www.sap.com/corporate-en/legal/copyright/index.epx#trademark for additional trademark information and notices.

    Table of content

    PUBLIC 2014 SAP AG or an SAP affiliate company. All rights reserved.

    Page 1 of 5

  • Table of content1 MDX Formula Syntax1.1 Simple Rule Formula Examples1.2 Advanced Rule Formula Examples1.3 Nested Formulas

    PUBLIC 2014 SAP AG or an SAP affiliate company. All rights reserved.

    Page 2 of 5

  • 1 MDX Formula Syntax

    UseThe basis for a dimension and advanced rule formulas is the multi-dimensional expression language called MDX.

    FeaturesYou can use the following features of MDX formula syntax:Syntax basics

    You can write the dimension ID using both uppercase and lowercase letters case, and the member ID should be the identical case of the member.You must enclose all member IDs in [square brackets].You must fully-qualify all member IDs, preceded by the names of their related dimension enclosed in square brackets, unless the dimension is ACCOUNT,in which case you may omit the dimension name.

    MDX syntax exceptionsThe following are exceptions to MDX syntax:

    Replace the keyword AS with an equal (=) sign.Do not use single quotes around expressions.

    Note that the following structure is the normal syntax for calculated members required by MDX queries:{member} = {expression}[, solve_order = n]The only exceptions are the equal sign (=) in place of the "AS" keyword and the lack of single quotes around the expression.

    More InformationFor examples of simple MDX formulas that can be used in the Formula column for an account, see Simple Rule Formula Examples.For examples of movement calculations and allocating expenses based on entity type, see Advanced Rule Formula Examples.

    1.1 Simple Rule Formula Examples

    UseThe following are examples of simple MDX formulas that can be used in the Formula column for an account:

    FeaturesTask Syntax and ExampleAdding two accounts Syntax:

    [DIMENSION].[ACCOUNT1] + [DIMENSION].[ACCOUNT2]

    ExamplePreTax Income:[ACCOUNT].[OPERATING INCOME] + [ACCOUNT].[OTHEREXP].

    Adding a range of accounts Syntax:[DIMENSION].[ACCOUNT1]:[DIMENSION].[ACCOUNT2]

    ExampleTotal Personnel Exp:SUM([ACCOUNT].[SALARIES]:[ACCOUNT].[COMMISSION])

    Calculating a percentage Syntax:[DIMENSION].[ACCOUNT1] / [DIMENSION].[ACCOUNT2]or (to prevent division by zero):IIF([DIMENSION].[ACCOUNT1] = 0, NULL,[DIMENSION].[ACCOUNT2]/[DIMENSION].[ACCOUNT1])

    ExampleGross Margin Pct:IIF([ACCOUNT].[REVENUE] = 0, NULL, [ACCOUNT].[GROSSMARGIN]/[ACCOUNT].[REVENUE])

    Multiplying by a factor Syntax:[DIMENSION].[ACCOUNT1]*[DIMENSION].[ACCOUNT2]

    ExampleTaxes:

    PUBLIC 2014 SAP AG or an SAP affiliate company. All rights reserved.

    Page 3 of 5

  • 1.2 Advanced Rule Formula Examples

    UseAdvanced rule formulas include movement calculations and expense allocation based on entity type.

    FeaturesYou can use the following features of advanced rule formulas:Movement calculationsMovement calculations define the copying or movement of data from one time period to another. In the formula examples below, [ AccRec] is the accountsreceivable account, and [ AccPay] is the accounts payable account.

    Example

    Allocating expenses based on entity typeThe following examples assume there is an Entity property named Function . If an entity has the function SM , the Total Department Expense is allocated to theS&M Exp account. If an entity has the function RD , the Total Department Expense is allocated to the R&D Exp account. If an entity has the function CORP , theTotal Department Expense is allocated to the G&A Exp account.

    Example

    [ACCOUNT].[PRETAX INCOME] * -0.35

    Calculating a YTD value Syntax:[DIMENSION].[ACCOUNT1],[MEASURES].[YTD]

    ExampleCurrent Year Net Income:([ACCOUNT].[NET INCOME], [MEASURES].[YTD])

    Account Description FormulaMvmt Acc Rec Movement in Accounts Receivable IIF([TIME].CURRENTMEMBER.PROPERTIES("CALC

    ")="N", [ACCOUNT].[ACCREC] -([ACCOUNT].[ACCREC], [TIME].PREVMEMBER),SUM(DESCENDANTS([TIME].CURRENTMEMBER, 20,LEAVES)))With the formula, you are checking whether the currentTIME member is parent or not by checking the propertyCALC = NO. If it is not a parent, then we take the currentTIME member's Account Receivables (ACCREC) andsubtract the previous month's Account Receivables. If thecurrent TIME member is parent, then you simply sumup all of the children.

    Mvmt Inventory Movement in Inventory IIF([TIME].CURRENTMEMBER.CHILDREN.COUNT=0, [ACCOUNT].[INVENTORY] -([ACCOUNT].[INVENTORY],[TIME].PREVMEMBER),SUM(DESCENDANTS([TIME].CURRENTMEMBER, 20,LEAVES)))The formula checks inventory.

    Mvmt Acc Pay Movement in Accounts Payable IIF([TIME].CURRENTMEMBER.CHILDREN.COUNT=0, [ACCOUNT].[ACCPAY] -([ACCOUNT].[ACCPAY], [TIME].PREVMEMBER),SUM(DESCENDANTS([TIME].CURRENTMEMBER, 20,LEAVES)))

    Mvmt Work Cap Movement in Working Capital SUM([ACCOUNT].[MVMT ACCREC]:[ACCOUNT].[MVMT ACC PAY])

    Account Description FormulaS&M Exp Sales & Marketing Expense IIF([ENTITY].CURRENTMEMBER.PROPERTIES("CA

    LC")="N",IIF([ENTITY].CURRENTMEMBER.PROPERTIES(FUNCTION ) = SM , [ACCOUNT].[TOTAL DEPTEXP], NULL),SUM(DESCENDANTS([ENTITY].CURRENTMEMBER,[ENTITY].[LEV1], LEAVES)))You first check if the current ENTITY member is parent ornot. Then, you read the property FUNCTION of the

    PUBLIC 2014 SAP AG or an SAP affiliate company. All rights reserved.

    Page 4 of 5

  • 1.3 Nested FormulasIn a nested formula, a given part of that formula is calculated by another formula.The functionality described in this topic applies only to systems based on SAP HANA, which enhances capabilities and improves performance of BusinessPlanning and Consolidation. If you are not using an SAP HANA-based system, disregard the information in this topic.

    PrerequisitesYou must have the SAP HANA Component for Planning and Consolidation HANABPCSP05 installed on your system.

    UseYou can create a nested formula in which the different parts of that formula are calculated by other formulas.

    ExampleA = B + CB = D - 6C = F * E

    In the example above, the formula A is calculated by B and C. In turn B and C are also calculated by formulas.Nested formulas are only supported by the HANA MDX engine. The HANA MDX engine significantly improves the performance when executing complexcalculations on large amounts of data.

    current ENTITY member to see whether it is "SM" or not.If it is "SM", then, you are taking the Total DepartmentExpense as a Sales & Marketing expense. Otherwise, itwill be assigned with zero. If current ENTITY is parent, asum of all children appears.

    R&D Exp R&D Expense IIF([ENTITY].CURRENTMEMBER.PROPERTIES("CALC")="N",IIF([ENTITY].CURRENTMEMBER.PROPERTIES(FUNCTION ) = RD , [ACCOUNT].[TOTAL DEPTEXP], NULL),SUM(DESCENDANTS([ENTITY].CURRENTMEMBER,[ENTITY].[LEV1], LEAVES)))In this formula, you are taking the "RD" values ofFUNCTION property.

    G&A Exp G&A Expense IF([ENTITY].CURRENTMEMBER.PROPERTIES("CALC")="N",IIF([ENTITY].CURRENTMEMBER.PROPERTIES(FUNCTION ) = CORP , [ACCOUNT].[TOTAL DEPTEXP], NULL),SUM(DESCENDANTS([ENTITY].CURRENTMEMBER,[ENTITY].[LEV1], LEAVES)))

    PUBLIC 2014 SAP AG or an SAP affiliate company. All rights reserved.

    Page 5 of 5