DAX SELECTEDVALUE function

Returns the value of a column when exactly one value is filtered, otherwise an alternate result.

SELECTEDVALUE is how a measure knows what the user picked: one country in a slicer, the row's country in a table. It is the base of dynamic titles.

Syntax

SELECTEDVALUE(<column>[, <alternateResult>])
ArgumentRequiredDescription
columnRequiredThe column to read.
alternateResultOptionalWhat to return when zero or several values are in view. Blank if left out.

Returns: A single value, or the alternate result.

Examples

Calculated on the free practice data (table financials), with [Total Sales] = SUM(financials[Sales]) and [Total Profit] = SUM(financials[Profit]).

1. The country in view

Selected Country = SELECTEDVALUE(financials[Country], "All countries")
CountrySelected Country
CanadaCanada
FranceFrance
GermanyGermany
MexicoMexico
United States of AmericaUnited States of America
TotalAll countries

Each row has one country; the total row has five, so it shows the alternate text.

Good to know

  • Use it for titles: "Sales for " & SELECTEDVALUE(financials[Country], "all countries").

Related functions

Official reference: SELECTEDVALUE function on Microsoft Learn