Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Count unique distinct values in two columns

Hi   I am trying to build a measure which counts unique value from two columns. This is perfect explanation what i want to do: Excel example. How i can similar get result with DAX?   Thank you
  • LivioLanzo's avatar
    LivioLanzo
    7 years ago

    Anonymous

     

    you can do it like this, but its most likely better to unpivot these 3 columns into 1 column and it gets much easier then

     

    = 
    COUNTROWS(
        DISTINCT(
            FILTER(
                UNION(
                    ALLNOBLANKROW( Data[Work place A] ),
                    ALLNOBLANKROW( Data[Work place B] ),
                    ALLNOBLANKROW( Data[Work place C] )
                ),
                [Work place A] <> ""
            )
        )
    )