OpenBI Docs Buy

Number.RoundAwayFromZero

Rounds away from zero: positive numbers up, negative numbers down, to whole numbers or decimal places.

Group: Number. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Number.RoundAwayFromZero(number as nullable number, optional digits as nullable number) as nullable number
ParameterTypeDescription
numbernullable numberThe number to work on; null gives null.
digitsnullable number
optional
How many decimal places to keep; 0, a whole number, when left out.

Returns

nullable number. The number moved to the next whole number (or decimal step) further from zero; null for null.

Remarks

  • Any fraction moves the number, not only a half: 12.1 becomes 13. To round halves away from zero and the rest to the nearest, use Number.Round with RoundingMode.AwayFromZero.

Examples

A positive number

Number.RoundAwayFromZero(12.1)
13

A negative number

Number.RoundAwayFromZero(-12.1)
-13

Two decimal places

Number.RoundAwayFromZero(-1.234, 2)
-1.24

Number.RoundTowardZero, Number.Round, Number.RoundUp, Number.RoundDown.

Last updated · OpenBI Studio 0.3.79