ISEVEN
Whether a number, rounded half away from zero to a whole number, is even.
Group: Information. Compatible with DAX.
Syntax
ISEVEN ( <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 even.
Remarks
- A decimal number is rounded half away from zero before the test: 2.4 counts as 2 (even), 2.5 as 3 (odd), −2.5 as −3.
- A blank counts as 0, so it is even: TRUE. TRUE counts as 1.
- Text that holds a number is read as that number; other text is an error. So is a number beyond the range of whole numbers.
MOD ( n, 2 ) = 0asks the same of a whole number.
Examples
Whole, decimal and blank
EVALUATE
ROW (
"4", ISEVEN ( 4 ),
"7", ISEVEN ( 7 ),
"2.4", ISEVEN ( 2.4 ),
"2.5", ISEVEN ( 2.5 ),
"-3", ISEVEN ( -3 ),
"Blank", ISEVEN ( BLANK () )
)
| 4 | 7 | 2.4 | 2.5 | -3 | Blank |
|---|---|---|---|---|---|
| TRUE | FALSE | TRUE | FALSE | FALSE | TRUE |
Counting the even rows
EVALUATE
VAR Numbers = DATATABLE ( "n", INTEGER, { { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 } } )
RETURN
ROW ( "Even ones", COUNTROWS ( FILTER ( Numbers, ISEVEN ( [n] ) ) ) )
| Even ones |
|---|
| 3 |