How does the SELECTEDVALUE function (DAX) work?
The SELECTEDVALUE function (DAX) returns Returns the value when the context for columnName has been filtered down to one distinct value only. Otherwise returns alternateResult.
SELECTEDVALUE Formula Syntax
How do you use the SELECTEDVALUE function?
You can used SELECTEDVALUE function to simplify the syntax required in many scenarios where you need to read a single value selected in the filter context, obtaining blank or another default value in all other cases.
Related Blog Posts
Related Support Forum Posts
Considerations when using the SELECTEDVALUE function
It is important to remember that:
- The SELECTEDVALUE and VALUES functions read the current filter context, not the row context;
- When you have a row context, just use a column reference (within RELATED in case it is in a lookup table);
- If the filter context returns zero rows for the referenced column, then SELECTEDVALUE returns the second argument – do not assume that the second argument is returned only when two or more values are selected;
- If you use a version of DAX that does not have SELECTEDVALUE, you can use the same pattern as that described in this article, replacing SELECTEDVALUE with the corresponding syntax using HASONEVALUE / VALUES.
Related Video Tutorials
Formula examples using the SELECTEDVALUE function
= SELECTEDVALUE(DimProduct[Color], “No Single Selection”)
= IF( ISFILTERED(‘Employee Details'[Employee Team Name]), SELECTEDVALUE(‘Employee Details'[Employee Team Name], “No Selection”), “No Selection”)
= SELECTEDVALUE(‘Expense Ratio'[Expense Ratio], 0.50)
Related Course Modules
To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.