SELECTEDMEASURE is a DAX function that returns the measure currently being evaluated.
Syntax
SELECTEDMEASURE( )
Return Values
A reference to the measure that is currently in context when the calculation item or format string is evaluated.
Remarks
Can only be referenced in the expression for a calculation item or format string.
This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.
The following calculation item expression calculates the year-to-date for whatever the measure is in context.
CALCULATE(SELECTEDMEASURE(), DATESYTD(DimDate[Date]))
The following expression can be used to dynamically adjust the format string of a measure based upon whether a value is the hundreds, thousands, or millions.
SWITCH(
TRUE(),
SELECTEDMEASURE() < 1000,"$#,##0", //Values less than 1000 have no text after them
SELECTEDMEASURE() < 1000000, "$#,##0,.0 K", //Values between 1000 and 1000000 are formatted as #.## K
"$#,##0,,.0 M" //Values greater than 1000000 are formatted as #.## M
)
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy