SELECTEDMEASURE DAX Function (Information) Context Transition
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
-
Computing MTD, QTD, YTD in Power BI for the current period
This article describes how to use the DAX time intelligence calculations applied to the latest period available in the data, also known as the “current” period. » Read more
-
Using field parameters and calculation groups for conditional formatting
This article describes how to apply conditional formatting on measures picked from a slicer and implemented using two techniques: field parameters and calculation groups. » Read more
-
Using calculation groups or many-to-many relationships for time intelligence selection
This article compares two common techniques to filter time periods in DAX: calculation groups and many-to-many relationships. » Read more
-
Scripting syntax for calculation groups
This article introduces the syntax to describe in a textual form the DAX expressions and additional properties of calculation groups. » Read more
-
Understanding the interactions between composite models and calculation groups
When used in a composite model, calculation groups show a very unique behavior that a good DAX developer must understand well to build sound models. In this article we describe how composite models and calculation groups work together. » Read more
-
Customizing default values for each user in Power BI reports
This article shows how to use calculation groups to define a default set of values for columns in your model. Different users can have different default values, and yet retain the full capability to select different values. » Read more
-
Using calculation groups to selectively replace measures in DAX expressions
This article describes how to use calculation groups to dynamically replace only a partial expression in a complex DAX calculation. » Read more
Related functions
Other related functions are:
Last update: Oct 3, 2024 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://docs.microsoft.com/en-us/dax/selectedmeasure-function-dax