IF.EAGER DAX Function (Logical)

Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE. Uses eager execution plan.

Syntax

IF.EAGER ( <LogicalTest>, <ResultIfTrue> [, <ResultIfFalse>] )
Parameter Attributes Description
LogicalTest

Any value or expression that can be evaluated to TRUE or FALSE.

ResultIfTrue

The value that is returned if the logical test is TRUE.

ResultIfFalse Optional

The value that is returned if the logical test is FALSE; if omitted, BLANK is returned.

Return values

Scalar A single value of any type.

Either ResultIfTrue or ResultIfFalse expression result, depending on LogicalTest.

Remarks

Calling IF.EAGER enforce eager evaluation of the conditional expression, instead of relying on choice between strict and eager evaluation made by the DAX engine.

The IF.EAGER was visible in the metadata only in the verified builds shown aside. It has been later removed from visible functions, even though it is still included in the engine. This function should be used only in very particular case of DAX optimization, after verifying that it produces a clear performance advantage compared to the regular IF function.

» 1 related article
» 3 related functions

Examples

--  The engine can use either STRICT or EAGER evaluation. 
--  The choice is up to the optimizer.
--  Using IF.EAGER you can force eager evaluation of IF statements.
--  Useful in some optimization scenarios.
DEFINE
    MEASURE Sales[GrossAmount] = SUMX ( Sales, Sales[Quantity] * Sales[Unit Price] )
    MEASURE Sales[NetAmount]   = SUMX ( Sales, Sales[Quantity] * Sales[Net Price] )
EVALUATE
ADDCOLUMNS (
    VALUES ( 'Product'[Brand] ),
    "Sales",
        IF ( 'Product'[Brand] = "Contoso", [GrossAmount], [NetAmount] * 1.5 )
)
ORDER BY 'Product'[Brand]
Brand Sales
A. Datum 3,144,276.96
Adventure Works 6,016,668.41
Contoso 8,098,022.18
Fabrikam 8,331,023.59
Litware 4,883,556.04
Northwind Traders 1,560,828.19
Proseware 3,819,216.24
Southridge Video 2,076,620.77
Tailspin Toys 487,563.63
The Phone Company 1,685,728.60
Wide World Importers 2,852,934.98

Related articles

Learn more about IF.EAGER in the following articles:

Related functions

Other related functions are:

Last update: Apr 2, 2021   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

2018-2021 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of IF.EAGER? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.