HASONEVALUE Function (DAX)
Returns TRUE when the context for columnName has been filtered down to one distinct value only. Otherwise is FALSE.
The name of an existing column, using standard DAX syntax. It cannot be an expression.
TRUE when the context for columnName has been filtered down to one distinct value only. Otherwise is FALSE.
An equivalent expression for HASONEVALUE() is COUNTROWS(VALUES(<columnName>)) = 1.
In the following example you want to create a formula that verifies if the context is being sliced by one value in order to estimate a percentage against a predefined scenario; in this case you want to compare Reseller Sales against sales in 2007, then you need to know if the context is filtered by single years. Also, if the comparison is meaningless you want to return BLANK.
If you want to follow the scenario, you can download the spreadsheet with the model from Power Pivot Sample Data spreadsheet.
Create a measure named [ResellerSales compared to 2007] using the following expression: