SELECTEDMEASURE DAX Function (Information)
Returns the measure that is currently being evaluated.
Syntax
This expression has no parameters.
Return values
A reference to the measure that is currently in context when the calculation item is evaluated.
» 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:
-
Introducing Calculation Groups
This article is the first of a series dedicated to calculation groups in DAX. This introduction explains the capabilities of this feature and how to create calculation groups in a Tabular model. » Read more
-
Understanding Calculation Groups
This article explores the properties of calculation groups in detail and then it describes how a calculation item is applied to a measure. Before starting, we suggest you read the previous article that introduces calculation groups. » Read more
-
Understanding the Application of Calculation Items
This article explains how calculation items are applied to measure references, and it is part of a series dedicated to calculation groups in DAX. Before starting, we suggest you read the previous articles in this series. » Read more
-
Understanding Calculation Group Precedence
This article explains the precedence of calculation groups in DAX, needed whenever multiple calculation groups are present within the same model. Before starting, we suggest you read the previous articles in this series. » Read more
-
Avoiding Pitfalls in Calculation Groups Precedence
This article describes in which conditions the precedence of calculation groups might return unexpected results when filtering calculation items in both the visuals and the measures present in a report. » Read more
Related functions
Other related functions are:
Last update: Sep 14, 2023 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://docs.microsoft.com/en-us/dax/selectedmeasure-function-dax