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
| Parameter | Type | Description |
|---|---|---|
number | nullable number | The number to work on; null gives null. |
digits | nullable 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.RoundwithRoundingMode.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
Related functions
Number.RoundTowardZero, Number.Round, Number.RoundUp, Number.RoundDown.