Number.RoundTowardZero is a Power Query M function that rounds a given number based on its sign, rounding positive numbers down and negative numbers up, with support for optional digits parameter. The function returns the rounded number.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Number.RoundTowardZero(
number as nullable number,
optional digits as nullable number,
) as nullable number
Description
Returns the result of rounding number
based on the sign of the number. This function will round positive numbers down and negative numbers up.
If digits
is specified, number
is rounded to the digits
number of decimal digits.
Examples
Round the number -1.2 toward zero.
// Output: -1
Number.RoundTowardZero( -1.2 )
Round the number 1.2 toward zero.
// Output: 1
Number.RoundTowardZero( 1.2 )
Round the number -1.234 to two decimal places toward zero.
// Output: -1.23
Number.RoundTowardZero( -1.234, 2 )
Related functions
Other functions related to Number.RoundTowardZero are:
