Number.RoundTowardZero

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 )

Other functions related to Number.RoundTowardZero are:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/number-roundtowardzero
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.