ISODD
Whether a number, rounded half away from zero to a whole number, is odd.
Group: Information. Compatible with DAX.
Syntax
ISODD ( <number> )
| Parameter | Type | Description |
|---|---|---|
number | Number | The number to test; a decimal number is first rounded to a whole one. |
Returns
Boolean. TRUE when the number, as a whole number, is odd.
Remarks
- A decimal number is rounded half away from zero first: 3.5 counts as 4 (even), 0.5 as 1 (odd).
- A blank counts as 0: FALSE. TRUE counts as 1: TRUE.
- Text that holds a number is read as that number, so
ISODD ( "5" )is TRUE; other text is an error.
Examples
Whole, decimal, text and blank
EVALUATE
ROW (
"7", ISODD ( 7 ),
"4", ISODD ( 4 ),
"3.5", ISODD ( 3.5 ),
"-3", ISODD ( -3 ),
"Text 5", ISODD ( "5" ),
"Blank", ISODD ( BLANK () )
)
| 7 | 4 | 3.5 | -3 | Text 5 | Blank |
|---|---|---|---|---|---|
| TRUE | FALSE | FALSE | TRUE | TRUE | FALSE |
Adding the odd rows
EVALUATE
VAR Numbers = DATATABLE ( "n", INTEGER, { { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 } } )
RETURN
ROW ( "Sum of the odd ones", SUMX ( FILTER ( Numbers, ISODD ( [n] ) ), [n] ) )
| Sum of the odd ones |
|---|
| 9 |