Number.IsOdd
true when a number is odd: it leaves 1 over when divided by 2, once its fraction is dropped.
Group: Number. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Number.IsOdd(number as number) as logical
| Parameter | Type | Description |
|---|---|---|
number | number | The number to test. |
Returns
logical. true for an odd number, negative ones too; false otherwise.
Remarks
- A fraction is dropped first, the number taken as the whole number at or below it: 2.5 is 2, so not odd, while -2.5 is -3, odd.
- null is an error: the parameter is a number, not a nullable one.
Examples
A negative odd number
Number.IsOdd(-3)
true
House numbers on the odd side of the street
List.Select({101, 102, 103, 104}, Number.IsOdd)
{101, 103}