Rounding in BEX queries – formulas

Share Button

Rounding in BEX queries – formulas

Summary

There is no rounding functionality in formulas in the BEX query Designer (if you feel this information is not true, please contact us).

Formula

If you want to round a key figure “KF” to have zero decimals:
( FRAC ( ‘KF’ ) < 0.5 ) * FLOOR ( ‘KF’ ) + ( FRAC ( ‘KF’) >= 0.5 ) * CEIL (‘KF’)

An equivalent MS Excel formula you can use to test is:
=IF(A3-TRUNC(A3)<0.5,FLOOR(A3,1),CEILING(A3,1))

If you want to round a key figure “KF” to have 2 decimals:
( FRAC ( ‘KF’*100 ) < 0.5 ) * FLOOR ( ‘KF’ * 100 ) / 100 + ( FRAC ( ‘KF’ * 100 ) >= 0.5 ) * CEIL (‘KF’ * 100) / 100

The equivalent MS Excel formula to test it is:
=IF(A5*100-TRUNC(A5*100)<0.5,FLOOR(A5*100,1)/100,CEILING(A5*100,1)/100 )

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *