SELECTEDMEASURENAME DAX Function (Information)

Returns name of the measure that is currently being evaluated.

Syntax

SELECTEDMEASURENAME ( )

This expression has no parameters.

Return values

Scalar A single string value.

Returns the name of the measure evaluated.

» 4 related articles
» 1 related function

Examples

-- Code of the calculation item Growth in the Time calc
-- calculation group used in the following example.
IF (
    SEARCH ( "Pct", SELECTEDMEASURENAME (), 1, -1 ) = -1,
    VAR CY =
        SELECTEDMEASURE ()
    VAR PY =
        CALCULATE (
            SELECTEDMEASURE (),
            SAMEPERIODLASTYEAR ( 'Date'[Date] )
        )
    VAR Result = CY - PY
    RETURN
        Result
)
--  SELECTEDMEASURENAME returns the name of the currently selected measure.
--  It can be used in place of ISSELECTEDMEASURE to search for specific
--  name patterns.
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 SELECTEDMEASURENAME in the following articles:

Related functions

Other related functions are:

Last update: Dec 4, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

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