Go to start of banner

# Calculations on Key Figures with Mixed Currencies or Units

## Introduction

• When Key Figures with currencies or units are used in Calculated Key Figures, a well-defined processing is only possible if all key figures have the same dimension and if there are only unique units or curencies, respectively.
• Once the calculations involve mixed currencies or units, different kind of problems may come up which, in general, cannot be avoided in all cases! Hence it is highly recommended to avoid mixed currencies/units by applying currency or unit conversion.
• The internal logic of how the OLAP Engine is doing calculations with mixed currencies or units might slightly differ between different releases and products (BW740, BW750 SP04 onwoards, BW4HANA).

## Mixed Currencies or Units should be avoided by an optimal Query Design

1. All key figures need to have the same dimension. If this is not the case, the warning BRAIN 206 is shown when the query is generated or executed.
2. When using key figures containing different quantities or different amounts, ensure Unit Conversions or Currency Conversions are in place to allow calculation on a common basis.

## Issues when accepting Mixed Currencies/Units

In case the required well-defined query design cannot be assured, the following problems may arise:

1. The result of a calculation might depend on how brackets are set in a formula. E.g. (A+B)*C and A*B+B*C can show different units/currencies.
2. Different kinds of internal optimizations (e.g. calculation before/after aggregation) might lead to different units/currencies in the result.
3. Internal rules try to meet expectations but do not guarantee a fully consistent calculation (from a mathematical perspective). E.g. formula calculation ends as soon as the first error is detected. As in point 1, a different processing of the same formula can lead to different results.

### Examples of problematic calculations

A formula contains one or more of the following key figures:

KFG_A = 5 EUR (currency)
KFG_B = 3 USD (currency)
KFG_C = 1 PC (unit)

1. Impact of brackets on calculations: (KFG_A - KFG_B) * 0  versus  KFG_A * 0 - KFG_B * 0
• (KFG_A - KFG_B) * 0
1. BW740:                           (KFG_A - KFG_B) * 0 = (5 EUR – 3 USD) * 0 = (2)MIX * 0 = 0
2. BW750/BW4HANA:        (KFG_A - KFG_B) * 0 = (5 EUR – 3 USD) * 0 = (2)MIX * 0 = (0) MIX
• KFG_A * 0 - KFG_B * 0 = 5 EUR * 0 – 3 USD * 0 = 0 EUR – 0 USD = 0 EUR or 0 USD (see note 667288)
2. Calculation with and without internal optimization: KFG_B + KFG_A - KFG_A
• With Internal optimization:
KFG_B + KFG_A - KFG_A = KFG_B (internal optimization removes KFG_A - KFG_A already before calculation)
• Without Internal optimization:
KFG_B + KFG_A - KFG_A = 5 EUR + 3 USD – 3 USD = (8) MIX – 3 USD = (5) MIX
3. After an error occured during calculation, the system stops processing: NDIV0 (KFG_A / 0 * KFG_C)  versus  NDIV0 (KFG_A / 0) * KFG_C
• NDIV0 (KFG_A / 0 * KFG_C)
1. BW740/BW750:   NDIV0 (5 EUR / 0 * 1 PC) = NDIV0 (5 EUR / 0 -> error raised) = 0 EUR
2. BW4HANA:          NDIV0 (5 EUR / 0 * 1 PC) = NDIV0 (5 EUR / 0 -> error raised) = 0
• NDIV0 (KFG_A / 0) * KFG_C
1. BW740/BW750:   NDIV0 (5 EUR / 0) * 1 PC = 0 EUR * 1 PC = 0 EUR PC
2. BW4HANA:          NDIV0 (5 EUR / 0) * 1 PC = 0 * 1 PC = 0 PC

### Important differences between releases/products

##### BW740 versus BW750/BW4HANA

With BW750/BW4HANA the behaviour changed as described in the below SAP note:
2298745 - 0 with mixed currency or unit as result of multiplication or division

For boolean operations scenarios this might require changes as described in the below KBA:
2448651 - BW750 - Boolean operators with mixed units/currencies

Alternative, it is possible to switch back to the old BW740 logic with help of the following SAP note:
2470572 - Switch RSROA_CL_FORM_SWITCH for enabling 0 * N MIXED = 0 (no unit/cur)

##### BW740/BW750 versus BW4HANA

With BW740/BW750 the NDIV0/NOERR functions work as follows:
- NDIV0/NOERR(5 EUR/0) = 0 EUR  ... dimension kept
- NDIV0/NOERR(5 MIX/0) = 0            ... dimension removed

With BW4HANA the NDIV0/NOERR functions work as follows:
- NDIV0/NOERR(5 EUR/0) = 0           ... dimension removed
- NDIV0/NOERR(5 MIX/0) = 0            ... dimension removed

### Calculation Rules - List with Examples

 BW7405 EUR * 0 = 0 EUR(5) MIX * 0 = 0(5) MIX * 1 = (5) MIX(0) MIX * 0 = 0(0) MIX * 1 = 05 EUR + 0 = 5 EUR5 EUR + 5 = (10) MIX5 EUR + (0) MIX = (5) MIX5 EUR + (1) MIX = (6) MIX5 MIX – 5 MIX = 0 (MIX)NDIV0/NOERRNDIV0   (5 EUR/0) = 0 EURNDIV0 (5 MIX/0) = 0 BW7505 EUR * 0 = 0 EUR(5) MIX * 0 = (0) MIX(5) MIX * 1 = (5) MIX(0) MIX * 0 = (0) MIX(0) MIX * 1 = (0) MIX5 EUR + 0 = 5   EUR  5 EUR + 5 = (10) MIX5 EUR + (0) MIX = (5) MIX5 EUR + (1) MIX = (6) MIX5 MIX – 5 MIX = 0 (MIX)NDIV0/NOERRNDIV0 (5 EUR/0) = 0 EURNDIV0 (5 MIX/0) = 0 BW4HANA5 EUR * 0 = 0 EUR(5) MIX * 0 = (0) MIX(5) MIX * 1 = (5) MIX(0) MIX * 0 = (0) MIX(0) MIX * 1 = (0) MIX5 EUR + 0 = 5   EUR  5 EUR + 5 = (10) MIX5 EUR + (0) MIX = (5) MIX5 EUR + (1) MIX = (6) MIX5 MIX – 5 MIX = 0 (MIX)NDIV0/NOERRNDIV0 (5 EUR/0) = 0NDIV0 (5 MIX/0) = 0

## Consulting notes

• 353297 - BRAIN 206: The element is not defined correctly
• 589260 - Units/currencies lost for values = 0
• 667288 - Unit or currency for key figures with value 0
• 984133 - The operators NDIV0 and NOERR delete unit and currency
• 1715035 - Aggregation and mixed units or currencies in BW 7.30
• 2298745 - 0 with mixed currency or unit as result of multiplication or division
• 2448651 - BW750 - Boolean operators with mixed units/currencies

• No labels