Number.Round

 

This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.

Returns a nullable number (n) if value is an integer.

Number.Round(value as nullable number, digits as nullable number,  roundingMode as nullable number) as nullable number  

ArgumentDescription
valueInteger value to round.
digitsFractional part is rounded by digits.
roundingModeSpecifies rounding direction when there is a tie between the possible numbers to round to. For Example, when the last digit of the number being rounded is 5 such as. 1.5 or 2.345.
Rounding modeDescription
RoundingMode.Up = 0Adds 5e-n to the number being rounded, where n is the number of fractional digits in the number.
RoundingMode.Down = 1Subtracts 5e-n from the number being rounded, where n is the number of fractional digits in the number.
RoundingMode.AwayFromZero = 2The same as RoundingMode.Up when the number being rounded is positive; otherwise, the same as

RoundingMode.Down.
RoundingMode.TowardZero = 3The same as RoundingMode.Down when the number being rounded is positive; otherwise, the same as RoundingMode.Up.
RoundingMode.ToEven = 4Applies RoundingMode.Up or

RoundingMode.Down to round the last digit to even.
  • If value >= 0, returns n with the fractional part rounded by digits using roundingMode.

  • if value < 0, it returns the integral part of n rounded to m-n decimal digits, using roundingMode, where m is the number of digits of n.

  • If roundingMode is not specified, RoundingMode.ToEven is used.

Number.Round(-1.249, 2) equals -1.25  

Number.Round(-1.245, 2) equals -1.24  

Number.Round(1.245, 2, RoundingMode.Up) equals 1.25  

Number.Round(1.245, 2, RoundingMode.Down) equals 1.24  

Number.Round(1.245, 2, RoundingMode.AwayFromZero) equals 1.25  

Number.Round(1.245, 2, RoundingMode.TowardZero) equals 1.24  

Number.Round(1.245, 2, RoundingMode.ToEven) equals 1.24  

Number.Round(-1.245, 2, RoundingMode.ToEven) equals -1.24  

Show: