GCD

Updated on

GCD is a DAX function that returns the greatest common divisor of two integers.

Syntax

GCD(
   Number1,
   Number2
)
Argument Properties Description
Number1 The first number, if value is not an integer, it is truncated.
Number2 The second number, if value is not an integer, it is truncated.

Return Values

The greatest common divisor of two or more integers.

Remarks

  • If any argument is nonnumeric, GCD returns the #VALUE! error value.

  • If any argument is less than zero, GCD returns the #NUM! error value.

  • One divides any value evenly.

  • A prime number has only itself and one as even divisors.

  • If a parameter to GCD is >=2^53, GCD returns the #NUM! error value.

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Example

DAX expression Description Result
= GCD(5, 2) Greatest common divisor of 5 and 2. 1
= GCD(24, 36) Greatest common divisor of 24 and 36. 12
= GCD(7, 1) Greatest common divisor of 7 and 1. 1

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/gcd-function-dax

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