Number.Mod

Updated on

Number.Mod is a Power Query M function that calculates the remainder resulting from the integer division of a number by a divisor. The function returns the remainder or null if either the number or divisor are null.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Number.Mod(
   number as nullable number,
   divisor as nullable number,
   optional precision as nullable number,
) as nullable number
Argument Attribute Description
number
divisor
precision optional The Precision.Type specifies the accuracy level for calculations. When omitting this argument, Power Query uses Precision.Double by default, which, while efficient, may cause rounding errors with very small fractions. For greater accuracy Precision.Decimal offers a more precise number representation, ideal for tasks requiring high precision.

Description

Returns the remainder resulting from the integer division of number by divisor. If number or divisor are null, Number.Mod returns null.

  • number: The dividend.
  • divisor: The divisor.

Examples

Find the remainder when you divide 5 by 3.

// Output: 2
Number.Mod( 5, 3 )

Other functions related to Number.Mod are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/number-mod

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy