ISSELECTEDMEASURE DAX Function (Information)

Returns true if one of the specified measures is currently being evaluated.

Syntax

ISSELECTEDMEASURE ( <Measure> [, <Measure> [, … ] ] )
Parameter Attributes Description
Measure Repeatable

Measure,…

Return values

Scalar A single boolean value.

True whether the measure that is currently in context is one of those specified in the list of parameters.

Remarks

ISSELECTEDMEASURE does not recognize a query measure. Therefore, if a model measure is redefined and used in a DAX query, ISSELECTEDMEASURE does not recognize that measure, whereas SELECTEDMEASURENAME still correctly intercepts the measure name.

» 3 related articles

Examples

-- Code of the calculation item Growth in the Time calc
-- calculation group used in the following example.
IF (
    NOT ISSELECTEDMEASURE ( [Pct over all prods] ),
    VAR CY =
        SELECTEDMEASURE ()
    VAR PY =
        CALCULATE (
            SELECTEDMEASURE (),
            SAMEPERIODLASTYEAR ( 'Date'[Date] )
        )
    VAR Result = CY - PY
    RETURN
        Result
)
--  ISSELECTEDMEASURE checks whether the current SELECTEDMEASURE is 
--  in the list of its arguments.
--
--  It can be used only in calculation items to modify the behavior
--  of the calculation item application depending on the currently
--  selected measure.
DEFINE
    MEASURE Sales[Sales Amount] =
        SUMX ( Sales, Sales[Quantity] * Sales[Net Price] )
    MEASURE Sales[Sales Quantity] =
        SUM ( Sales[Quantity] )
EVALUATE
SUMMARIZECOLUMNS (
    'Product'[Brand],
    'Date'[Calendar Year],
    'Time calc'[Time calc],
    TREATAS ( { "CY 2008" }, 'Date'[Calendar Year] ),
    TREATAS ( { "Contoso", "Fabrikam" }, 'Product'[Brand] ),
    "Sales Amount", [Sales Amount],
    "Quantity", [Sales Quantity],
    "% of Products", [Pct over all prods]
)
ORDER BY
    'Product'[Brand],
    'Date'[Calendar Year],
    'Time calc'[Time calc]
Brand Calendar Year Time calc Sales Amount Quantity % of Products
Contoso 2008-01-01 Current 2,369,167.68 14,901.00 54.31%
Contoso 2008-01-01 Growth -360,650.85 429.00 (Blank)
Contoso 2008-01-01 Growth % -0.13 0.03 (Blank)
Contoso 2008-01-01 Prev Year 2,729,818.54 14,472.00 62.29%
Fabrikam 2008-01-01 Current 1,993,123.48 3,899.00 45.69%
Fabrikam 2008-01-01 Growth 340,372.14 701.00 (Blank)
Fabrikam 2008-01-01 Growth % 0.21 0.22 (Blank)
Fabrikam 2008-01-01 Prev Year 1,652,751.34 3,198.00 37.71%

Related articles

Learn more about ISSELECTEDMEASURE in the following articles:

Last update: Nov 14, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/isselectedmeasure-function-dax

2018-2024 © 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.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

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 ISSELECTEDMEASURE? 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.