DAX function
HASONEVALUE — DAX function reference
True if exactly one value.
Syntax
dax
HASONEVALUE(<column>)
Examples
dax
HASONEVALUE(Sales[Region])
→ true / false
dax
IF(HASONEVALUE(Sales[Region]), "Region: " & VALUES(Sales[Region]), "All regions")
→ Manual equivalent of SELECTEDVALUE
dax
IF(HASONEVALUE(Product[Category]) && HASONEVALUE(Product[SubCategory]), [Total Sales], BLANK())
→ Only shows a value at the most granular level of a hierarchy
Common mistakes & gotchas
- HASONEVALUE(column) is equivalent to COUNTROWS(VALUES(column)) = 1 but is optimized to short-circuit faster — prefer it when you just need the boolean.
- Since SELECTEDVALUE was introduced, most HASONEVALUE + VALUES pairs can be replaced by it — reach for HASONEVALUE directly when you need the boolean itself to gate a more complex expression, not just to return the value.
Related DAX functions
From Filter context