HASONEVALUE Function (DAX)

How does the HASONEVALUE function (DAX) work?

Returns TRUE if only one distinct value has been filtered to the context for columnName. Otherwise, it is FALSE.

HASONEVALUE Formula Syntax

HASONEVALUE(<columnName>)

How do you use the HASONEVALUE function?

An equivalent expression for HASONEVALUE() is COUNTROWS(VALUES(<columnName>)) = 1.

Related Blog Posts

 

Considerations when using the HASONEVALUE function

HASONEVALUE() allows you to identify if your expression is being evaluated in the context of a single value for columnName.

Related Video Tutorials

EDNA TV-Unique subtotal
EDNA TV-Harvesting a slicer selection

Formula examples using the HASONEVALUE function

=IF(HASONEVALUE(DateTime[CalendarYear]),SUM(ResellerSales_USD[SalesAmount_USD])/CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]),DateTime[CalendarYear]=2007),BLANK())  
 

Related DAX Functions

HASONEFILTER
 
 

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI