Wyn Enterprise User Guide

Logical Functions

The logical functions return information about values in an expression. For example, the TRUE function helps you to determine whether an expression that you are evaluating returns a TRUE value.

Following is the list of logical functions supported in Wyn Enterprise:

AND


Description

The AND function checks whether both arguments are TRUE, and returns TRUE if both arguments are TRUE. Otherwise returns false. Checks whether both arguments are TRUE, and returns TRUE if both arguments are TRUE. Otherwise returns FALSE.

Syntax

AND(<logical1>,<logical2>) 

Parameters

Parameter Description
logical1 The logical values you want to test.
logical2 The logical values you want to test.

Return Value

Returns TRUE or FALSE depending on the combination of values that you test.

Example

AND('Sale'[SaleAmount]>100,'Product'[Name]="Wyn")

IF


Description

The IF function checks a condition and returns one value when it's TRUE, otherwise, it returns a second value.

Syntax

IF(<logical_test>, <value_if_true>[, <value_if_false>])

Parameters

Parameter Description
logical_test Any value or expression that can be evaluated to TRUE or FALSE.
value_if_true The value that's returned if the logical test is TRUE.
value_if_false (optional) The value that's returned if the logical test is FALSE. If omitted, BLANK is returned.

Return Value

Either value_if_true, value_if_false, or NULL.

Example

IF('Sale'[Amount]>100, "High","Low")

NOT


Description

The NOT function changes FALSE to TRUE, or TRUE to FALSE.

Syntax

NOT(<logical>)

Parameters

Parameter Description
logical A value or expression that can be evaluated to TRUE or FALSE.

Return Value

TRUE or FALSE.

Example

NOT('Sale'[Amount] > 109)

OR


Description

The OR function checks whether one of the arguments is TRUE to return TRUE. The function returns FALSE if both arguments are FALSE.

Syntax

OR(<logical1>,<logical2>)

Parameters

Parameter Description
logical1 The logical values you want to test.
logical2 A constant value to be matched with each row.

Return Value

A boolean value. The value is TRUE if any of the two arguments is TRUE; the value is FALSE if both the arguments are FALSE.

Example

OR('Sale'[Amount]> 10,'Category'[Key]>1)

SWITCH


Description

The SWITCH evaluates an expression against a list of values and returns one of the multiple possible result expressions.

Syntax

SWITCH(<expression>, <value>, <result>[, <value>, <result>]…[, <else>])

Parameters

Parameter Description
expression Any expression that returns a single scalar value, where the expression is to be evaluated multiple times (for each row/context).
value A constant value to be matched with the results of the expression.
result Any scalar expression to be evaluated if the results of expression match the corresponding value.
else Any scalar expression to be evaluated if the result of expression doesn't match any of the value arguments.

Return Value

A scalar value that comes from one of the result expressions, if there was a match with value, or from the else expression, if there was no match with any value.

Example

SWITCH([Month], 1, "January", 2, "February", 3, "March", 4, "April", 5, "May", 6, "June", 7, "July", 8, "August", 9, "September", 10, "October", 11, "November", 12, "December", "Unknown month number" ) 

SWITCH(TRUE,'Sale'[Amount] < 100 ,"less",'Sale'[Amount]=100,"equal100","greater")