OpenBI Docs Buy

GCD

The largest whole number that goes into both of two whole numbers without a remainder.

Group: Math. Compatible with DAX.

Syntax

GCD ( <number1>, <number2> )
ParameterTypeDescription
number1Whole numberA whole number of 0 or more.
number2Whole numberA second whole number of 0 or more.

Returns

Whole number. The greatest common divisor of the two; 0 when both are 0.

Remarks

  • It takes exactly two numbers. For more, nest the calls: GCD ( GCD ( 12, 18 ), 24 ).
  • Decimals are rounded to whole numbers first, a half away from zero: GCD ( 24.6, 36 ) is GCD ( 25, 36 ), 1.
  • When one number is 0 the other is the answer; a blank counts as 0. A negative number is an error.

Examples

Common divisors

EVALUATE
ROW (
    "24 and 36", GCD ( 24, 36 ),
    "12, 18 and 24", GCD ( GCD ( 12, 18 ), 24 ),
    "7 and 0", GCD ( 7, 0 ),
    "17 and 5", GCD ( 17, 5 )
)
24 and 3612, 18 and 247 and 017 and 5
12671

LCM, MOD, QUOTIENT.

Last updated · OpenBI Studio 0.3.74