Show TOC

Function documentationSimple Rule Formula Examples Locate this document in the navigation structure

 

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

Features

Task

Syntax and Example

Adding two accounts

Syntax:

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

Example Example

PreTax Income:

[ACCOUNT].[OPERATING INCOME] + [ACCOUNT].[OTHEREXP].

End of the example.

Adding a range of accounts

Syntax:

[DIMENSION].[ACCOUNT1]:[DIMENSION].[ACCOUNT2]

Example Example

Total Personnel Exp:

SUM([ACCOUNT].[SALARIES]:[ACCOUNT].[COMMISSION])

End of the example.

Calculating a percentage

Syntax:

[DIMENSION].[ACCOUNT1] / [DIMENSION].[ACCOUNT2]

or (to prevent division by zero):

IIF([DIMENSION].[ACCOUNT1] = 0, NULL, [DIMENSION].[ACCOUNT2]/[DIMENSION].[ACCOUNT1])

Example Example

Gross Margin Pct:

IIF([ACCOUNT].[REVENUE] = 0, NULL, [ACCOUNT].[GROSS MARGIN]/[ACCOUNT].[REVENUE])

End of the example.

Multiplying by a factor

Syntax:

[DIMENSION].[ACCOUNT1]*[DIMENSION].[ACCOUNT2]

Example Example

Taxes:

[ACCOUNT].[PRETAX INCOME] * -0.35

End of the example.

Calculating a YTD value

Syntax:

[DIMENSION].[ACCOUNT1],[MEASURES].[YTD]

Example Example

Current Year Net Income:

([ACCOUNT].[NET INCOME], [MEASURES].[YTD])

End of the example.

Any software coding and/or code lines / strings ("Code") included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended to better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or by its gross negligence.