Show TOC

# Formula Calculation and Special Values

Use

This section explains the basic rules that the system uses to calculate zero values and other special values into formulae.

Note

See SAP Note 794006 for more details.

The following special values are explained:

• ZERO represents the value zero;

• DIV0 is the result of a division by 0;

• ERROR displays an error;

• NOP displays that no aggregation is possible.

• W stands for a valid value and * for a value;

• O1 is a unary operator (such as NODIM, NOERR)

• O2 is a binary operator (wie +, -, *)

NOP is the result of aggregations NO1, NO2, and NOP (see Aggregation and Special Values). As the result of an operation (or a non-homogeneous value set) NOP has lost its place between ZERO and ERROR in the following priority rule.

1. ERROR/DIV0

2. NOP

3. ZERO or a normal value depending on the operation.

The following rules apply for formulae:

 NOERR( ERROR ) = 0, NDIV0(DIV0) = 0, O1(NULL) = ZERO and O1(ERROR) = ERROR for all remaining unary operators O1. For NOP also NOERR(NOP) = 0, NDIV0(NOP) = NOP, O1(NOP) = NOP for all remaining unary operators O1. This basic rule states that all operators only result in one parameter DIV0 / NULL / ERROR / NOP values provided that the parameter is DIV0, ZERO, ERROR, or NOP and the operator is not an operator for suppressing these values. O2(ZERO,ZERO) = ZERO, O2(ERROR,*)= ERROR and O2(*,ERROR) = ERROR for all binary operators. This basic rule states that ERROR (including DIV0) is dominant in all operations and all operations with only ZERO as an entry also have ZERO as their result. O2(ERROR,NOP)= ERROR and O2( {value OR NULL} ,NOP) = NOP for all binary operators. This basic rule states that DIV0/ERROR is dominant over NOP, and NOP is dominant over all other values. O2(ZERO,W) = O2(0,W) and O2(W,ZERO) = O2(W,0) with exception of the following combinations that have ZERO as their result: ZERO * W, W * ZERO, ZERO / W, ZERO %A W, ZERO %_A W, ZERO %RT W, ZERO %GT W, ZERO %CT W, ZERO ** W, ZERO DIV W, ZERO MOD W.

In the BW system, the OLAP processor behaves in such a way that adding a structure element does not also have to mean a change to the content of all other structure elements. The OLAP processor also therefore handles a division by zero without canceling the query immediately. If a cell also contains a division by zero or another error, the other cells do not need to be affected.

As DIV0 is a special type of ERROR, DIV0 and ERROR behave in the same way when they are combined with other paramter values in operations. The bahvaior of DIV0 and ERROR in binary operations is unspecific and depends on the binary operation O2:

• O2(DIV0, ERROR) = DIV0 or ERROR

• O2(ERROR, DIV0) = DIV0 or ERROR

DIV0 is more specific and can therefore get the priority before ERROR. But the behavior is not defined uniquely.

The following table gives an overview of the behavior and all rules:

Operator

Left Operand

Right Operand

+, -

Y

ZERO

NOP

DIV0 / ERROR

X

X or Y

X

NOP

DIV0 / ERROR

ZERO

Y (-Y)

ZERO + Y results in Y

ZERO - Y results in -Y.

ZERO

NOP

NOP

DIV0 / ERROR

DIV0 / ERROR

*

X

X or Y

ZERO

NOP

ZERO

ZERO

ZERO

NOP

NOP

DIV0 / ERROR

DIV0 / ERROR

/, DIV, MOD

X

X or Y

if Y = 0, the result is DIV0.

DIV0

NOP

ZERO

ZERO

ZERO

NOP

NOP

if Y = 0, the result is DIV0.

DIV0

DIV0 / ERROR

DIV0 / ERROR

High (**)

X

X ** Y

1

NOP

ZERO

ZERO

ZERO

NOP

NOP

DIV0 / ERROR

DIV0 / ERROR

%, %_A, %_RT, %_GT, %_CT

X

X or Y

X op 0

NOP

ZERO

ZERO

ZERO

NOP

NOP

DIV0 / ERROR

DIV0 / ERROR

Other operations, such as MIN, MAX

X

X or Y

X op 0

NOP

ZERO

0 op Y

ZERO

NOP

NOP

DIV0 / ERROR

DIV0 / ERROR