DAX Deep Dive 06 : Power BI DAX Master Guide – Everything About SELECTEDMEASURE()
1. What is SELECTEDMEASURE()? Simply put, it is a "placeholder" that refers to the "very measure currently being calculated." Normally, when writing DAX, you explicitly use the name of a measure, such as [Total Sales]. However, within Dynamic Format Strings or Calculation Groups, it is impossible to know in advance which measure will be used. In these cases, SELECTEDMEASURE() acts as a command that says, "Whichever measure comes in, fetch its value first!" • Usage: Dynamic Format Strings, Calculation Groups • Characteristics: Since you don’t need to hard-code measure names, the reusability of your code is maximized. 2. Why is SELECTEDMEASURE() a 'Revolution'? Suppose a company report has 50 different metrics, and you need to apply a rule to every single one of them: "If the value is 1 million or more, attach an 'M' unit; if it is 1,000 or more, attach a 'K' unit." ...