Goal: Detect if we are looking at a single item or the Grand Total.
HASONEVALUE is the sensor for this.
Ready...
💻 DAX Formula
-- Scenario 1: The Sensor
MEASURE Is_Single_Color = HASONEVALUE( Sales[Color] )
-- Returns TRUE for rows, FALSE for Total.
-- Scenario 2: Hide Calculation at Total
MEASURE Safe_Rank =
IF(
HASONEVALUE( Sales[Color] ),
[MyRankingMeasure], -- Show Rank
BLANK() -- Hide at Total
)