SELECTEDMEASURE DAX Function (Information)

Returns the measure that is currently being evaluated.

Syntax

SELECTEDMEASURE ( )

This expression has no parameters.

Return values

Scalar A single value of any type.

A reference to the measure that is currently in context when the calculation item is evaluated.

» 12 related articles
» 1 related function

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
)
--  SELECTEDMEASURE is a placeholder used in calculation items
--  to represent the measure currently being modified by the
--  calculation item.
--
--  During the application process, each reference to SELECTEDMEASURE
--  is replaced with 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 (
    'Date'[Calendar Year],
    'Time calc'[Time calc],
    TREATAS ( { "CY 2008" }, 'Date'[Calendar Year] ),
    "Sales Amount", [Sales Amount],
    "Quantity", [Sales Quantity]
)
ORDER BY
    'Date'[Calendar Year],
    'Time calc'[Time calc]
Calendar Year Time calc Sales Amount Quantity
2008-01-01 Current 9,927,582.99 40,226.00
2008-01-01 Growth -1,382,363.13 -4,084.00
2008-01-01 Growth % -0.12 -0.09
2008-01-01 Prev Year 11,309,946.12 44,310.00

Related articles

Learn more about SELECTEDMEASURE in the following articles:

Related functions

Other related functions are:

Last update: May 23, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/selectedmeasure-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 SELECTEDMEASURE? 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.