0% found this document useful (0 votes)
14 views15 pages

06 Information Functions

The document provides an overview of various DAX functions including CONTAINS, IN operator, ISBLANK, ISERROR, ISEVEN, ISINSCOPE, ISLOGICAL, ISNONTEXT, ISNUMBER, ISODD, ISTEXT, LOOKUPVALUE, and USERNAME. Each function is described with its syntax, parameters, return values, and examples. These functions are used for data analysis and manipulation in DAX, allowing users to check conditions, retrieve values, and validate data types.

Uploaded by

turningpoint.mk0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views15 pages

06 Information Functions

The document provides an overview of various DAX functions including CONTAINS, IN operator, ISBLANK, ISERROR, ISEVEN, ISINSCOPE, ISLOGICAL, ISNONTEXT, ISNUMBER, ISODD, ISTEXT, LOOKUPVALUE, and USERNAME. Each function is described with its syntax, parameters, return values, and examples. These functions are used for data analysis and manipulation in DAX, allowing users to check conditions, retrieve values, and validate data types.

Uploaded by

turningpoint.mk0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

CONTAINS

Returns true if values for all referred columns exist, or are contained, in those columns;
otherwise, the function returns false.

Syntax

DAX Copy
CONTAINS(<table>, <columnName>, <value>[, <columnName>, <value>]…)

Parameters

Term Definition
table Any DAX expression that returns a table of data.
columnNa The name of an existing column, using standard DAX syntax. It cannot be an
me expression.
Any DAX expression that returns a single scalar value, that is to be sought in
value columnName. The expression is to be evaluated exactly once and before it is
passed to the argument list.

Return value

A value of TRUE if each specified value can be found in the corresponding columnName,
or are contained, in those columns; otherwise, the function returns FALSE.

Example:

=CONTAINS(InternetSales, [ProductKey], 214, [CustomerKey], 11185)


IN Operator

Returns TRUE if a row of values exists or contained in a table, otherwise returns FALSE.
Except syntax, the IN operator and CONTAINSROW function are functionally equivalent.

IN Operator

Syntax

<scalarExpr> IN <tableExpr>
( <scalarExpr1>, <scalarExpr2>, … ) IN <tableExpr>
CONTAINSROW function

Syntax

CONTAINSROW(<tableExpr>, <scalarExpr>[, <scalarExpr>, …])

Parameters

Term Definition
scalarExp Any valid DAX expression that returns a scalar
rN value.
Any valid DAX expression that returns a table
tableExpr
of data.

Return value

TRUE or FALSE.

Exmaple:

EVALUATE FILTER(ALL(DimProduct[Color]), ([Color]) IN { "Red", "Yellow",


"Blue" })

ORDER BY [Color]
ISBLANK

Checks whether a value is blank, and returns TRUE or FALSE.

Syntax

ISBLANK(<value>)

Parameters

Ter
Definition
m
valu The value or expression you want
e to test.

Return value

A Boolean value of TRUE if the value is blank; otherwise FALSE.

Example:
ISERROR

Checks whether a value is an error, and returns TRUE or FALSE.

Syntax

DAX Copy

ISERROR(<value>)

Parameters

Ter
Definition
m

valu The value you want to


e test.

Return value

A Boolean value of TRUE if the value is an error; otherwise FALSE.

Example:
ISEVEN

Returns TRUE if number is even, or FALSE if number is odd.

Syntax

DAX Copy

ISEVEN(number)

Parameters

Term Definition

numb The value to test. If number is not an integer, it is


er truncated.

Return value

Returns TRUE if number is even, or FALSE if number is odd.


ISINSCOPE

Returns true when the specified column is the level in a hierarchy of levels.

Syntax

DAX Copy

ISINSCOPE(<columnName>)

Parameters

Term Definition

columnNa The name of an existing column, using standard DAX syntax. It cannot be an
me expression.

Return value

TRUE when the specified column is the level in a hierarchy of levels.

Example:
ISLOGICAL

Checks whether a value is a logical value, (TRUE or FALSE), and returns TRUE or FALSE.

Syntax

DAX Copy

ISLOGICAL(<value>)

Parameters

Ter
Definition
m

valu The value that you want to


e test.

Property Value/Return value

TRUE if the value is a logical value; FALSE if any value other than TRUE OR FALSE.

Example:

//RETURNS: Is Boolean type or Logical

=IF(ISLOGICAL(true), "Is Boolean type or Logical", "Is different type")


ISNONTEXT

Checks if a value is not text (blank cells are not text), and returns TRUE or FALSE.

Syntax

DAX Copy

ISNONTEXT(<value>)

Parameters

Ter
Definition
m

valu The value you want to


e check.

Return value

TRUE if the value is not text or blank; FALSE if the value is text.

Example

//RETURNS: Is Non-Text
=IF(ISNONTEXT(1), "Is Non-Text", "Is Text")
ISNUMBER

Checks whether a value is a number, and returns TRUE or FALSE.

Syntax

DAX Copy

ISNUMBER(<value>)

Parameters

Ter
Definition
m

valu The value you want to


e test.

Property Value/Return value

TRUE if the value is numeric; otherwise FALSE.

Example

//RETURNS: Is number
=IF(ISNUMBER(0), "Is number", "Is Not number")
ISODD

Returns TRUE if number is odd, or FALSE if number is even.

Syntax

DAX Copy

ISODD(number)

Parameters

Term Definition

numb The value to test. If number is not an integer, it is


er truncated.

Return value

Returns TRUE if number is odd, or FALSE if number is even.


ISTEXT

Checks if a value is text, and returns TRUE or FALSE.

Syntax

DAX Copy

ISTEXT(<value>)

Parameters

Ter
Definition
m

valu The value you want to


e check.

Property Value/Return value

TRUE if the value is text; otherwise FALSE

Example:

//RETURNS: Is Text

=IF(ISTEXT("text"), "Is Text", "Is Non-Text")


LOOKUPVALUE

Returns the value in result_columnName for the row that meets all criteria specified by
search_columnName and search_value.

Syntax

DAX Copy

LOOKUPVALUE( <result_columnName>, <search_columnName>, <search_value>[,


<search_columnName>, <search_value>]…[, <alternateResult>])

Parameters

Term Definition

The name of an existing column that contains the value you want to return.
result_columnNa
The column must be named using standard DAX syntax, usually, fully qualified.
me
It cannot be an expression.

The name of an existing column, in the same table as result_columnName or in


search_columnNa a related table, over which the look-up is performed. The column must be
me named using standard DAX syntax, usually, fully qualified. It cannot be an
expression.

A scalar expression that does not refer to any column in the same table being
search_value
searched.

(Optional) The value returned when the context for result_columnName has
been filtered down to zero or more than one distinct value. When not provided,
alternateResult
the function returns BLANK() when result_columnName is filtered down to zero
value or an error when more than one distinct value.

Return value

The value of result_column at the row where all pairs of search_column and search_value
have a match.
If there is no match that satisfies all the search values, a BLANK or alternateResult, if
supplied, is returned. In other words, the function will not return a lookup value if only
some of the criteria match.

If multiple rows match the search values and in all cases result_column values are
identical then that value is returned. However, if result_column returns different values
an error or alternateResult, if supplied, is returned.

Example:

=LOOKUPVALUE(Product[SafetyStockLevel], [ProductName], " Mountain-400-W Silver,


46")
USERNAME

Returns the domain name and username from the credentials given to the system at
connection time.

Syntax

DAX Copy

USERNAME()

Parameters

Return value

The username from the credentials given to the system at connection time

Example:

=IF(CONTAINS(UsersTable,UsersTable[login], USERNAME()), "Allowed",


BLANK())

You might also like