Go to start of banner

# OLAP: Decimal Places & Rounding

## Number of Decimal Places displayed in Query

The number of decimal places for key figures can be defined on

1. InfoObject level: in transaction RSD1 (or in Hana Modeling Tool) on the tab 'Additional Properties' for the basis key figure
2. InfoProvider level: in transaction RSA1(or in Hana Modeling Tool) -> Provider Specific Properties -> Additional Properties for the key figure
3. Query level: In QueryDesigner (or BW Modeling Tool) -> Properties for the key figure

The setting on query level overrides the one on the Provider level and the Provider level setting in turn overrides the one on InfoObject level, see also note 2313517.

#### Basis Key Figure used in Query

E.g. the currency EUR has two decimal places. Hence, by default the query displays 2 decimal places, e.g. 123.16 EUR. When we change the query setting to 1 decimal place, the value is rounded to 1 decimal place, so the result is 123.2 EUR. Of course it is possible change the setting to more than 2 decimal places, but then only zeros are added, e.g. 123.16000 EUR.

#### Calculated Key Figure used in Query

By default, the Analytic Engine uses internally the type DECFLOAT16 for numerical data, but it is possible to switch to a higher accuracy, see Query Property: Calculate with High Precision. The query always uses the ABAP type DECFLOAT32 when the data is transferred to the frontend. The maximum of decimal places displayed in the query result is 9. In principle all 9 places can be displayed for formulas(use corresponding setting in QueryDesigner), the defaults of formulas using amount and quantity key figures(see above) are 2 or 3, respectivelly.

Hence, when a amount key figure is used in a formula, more decimal places as defined for the currency(TCURX) can be displayed. So, a value in the query result could be 123.162345 EUR and not only 123.160000 EUR as for basis key figures(when number of decimal places is set to 6).

##### Calculated Key Figure / Formula with Exception Aggregation(or FAGRR)

As explained in note 1459727, by default, key figures with exception aggregation AVG, AV1 and AV2 are displayed with three decimal places and key figures with exception aggregation STD or VAR are displayed with five decimal places.

Example

Query result of a key figure once using execption aggr. VAR and once without any exception aggregation, the 'number of decimal places' is set to default. Hence, the key figure with exceptin aggregation is displayed with 5 decimal places: ##### Calculated Key Figure using the Result Set Operation 'Calculate Result as...'

In case the formula(or Calculated Key Figure) uses feature 'Calculate Result as...', the number of decimal places displayed in the query follows special rules. In the past, it has been defined to use three decimals for the result of local calculation average AVG and five decimals for STD and VAR aggregation. A flexible customizing of decimal places for the result value is nowadays possible but only when note 2382116 is implemented. The note also describes in detail how you can specify the desired number of decimal places by using RSADMIN parameters.

Example

Query result of key figure using 'Calculate Result as AVG' and 'number of decimal places'=1. Parameters of note 2382116 are NOT used: ## Rounding of Values

In general, when the number of decimal places used for a key figure is smaller than the accuracy of the calculated value, it is rounded accordingly. E.g. if the internal value has 2 decimal places but the query displays only 1, a value like 123.16 EUR is rounded to 123.2 EUR.

##### Local Calculation 'Calculate result as Summation of Rounded Values'

If you compare the sum of such values(in a query) with the list of summands, you will notice that the OLAP Engine uses the internal values for calculating the sum and then carries out the rounding(see Rounding: Example I). In case it is required to get the sum of rounded values you need to use the local operation 'Calculate result as Summation of Rounded Values'.

Example

The first column (key figure) shows the the values with full accuracy. In the second column the display of this key figure is restricted to zero decimal places. In the third column 'Calculate result as Summation of Rounded Values' is used: ##### Floating Point Numbers

Key Figures of data type FLTP (floating point number) have the big downside that rounding inaccuracies cannot be avoided, see Key Figures of data type FLTP  for more details.

##### Basis Quantity Key Figure

The display of quantity key figures depend on settings of the quantity in table T006. E.g. if there is a record in T006 for KG with the settings

• DECAN = 2
• ANDEC = 2

the e.g. the value 123.126 KG is rounded to 123.13 KG and, hence DECAN is also 2, finally displayd as 123.13 KG in the query.

See Key Figures of data Type QUAN 'Quantity Field' for further details.

##### Query Property 'Calculate with High Precesion'

As already mentioned, by default, the Analytic Engine uses internally the type DECFLOAT16 for numerical data, but it is possible to switch to a higher accuracy by activating the query property 'Calculate with High Precesion'. Choose this option only when a high accuracy is really required since it requires more memory. See Query Property: Calculate with High Precision for more details.

## Relevant SAP Notes

• 1240163 - Amount too high by factor of 100 for HUF, JPY currencies
• 2085589 - Extending an Amount Key Figure of Currency Type in BW
• 460652   - Extending key figures in BW
• 2313517 - Currency or Unit Dependent Decimal in a BW Query
• 2382116  - Switch for decimal places of AVG, AV1, AV2, STD and VAR local aggregation
• 959467  - hard coded 3 digits when setting is less than 3.
• 995517  - The corrections in this note reverse step 4 of Note 959467.
• 1339773 - Rounding and decimal places for AVG & STD exception aggregations. (3 decimals for AVG, 5 decimals for STD/VAR)
• 1459727 - Subsequent correction to Note 1339773. (3 decimals for AVG exception aggregation)
• 1506525 - Correction of note 1459727: Wrong decimal places.
• 2096911 - Decimal places in query result is wrong, if average is used and display precision is set to less than 3, it will always show 3 decimal places
• No labels