Simple Rule Formula Examples

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

Task

Syntax and Example

Adding two accounts

Syntax:

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

Example

PreTax Income:

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

Adding a range of accounts

Syntax:

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

Example

Total 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])

Example

Gross Margin Pct:

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

Multiplying by a factor

Syntax:

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

Example

Taxes:

[ACCOUNT].[PRETAX INCOME] * -0.35

Calculating a YTD value

Syntax:

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

Example

Current Year Net Income:

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

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.