Forum Discussion

NSBS's avatar
NSBS
Helper I
4 years ago
Solved

Row Comparison and Detecting Different Corresponding Values

Hi Experts,

 

Kindly help to give idea on how should I compare below row to detect which ID have more than 1 names.

My Original Dataset only consists of Column ID and Name. And I want the result to be reflected as per Expected Result Column.

IDNameExpected Result
123Greg1 ID have more than 1 names
892Nat1 ID per 1 Name
878Tina1 ID per 1 Name
748Aid1 ID have more than 1 names
123Raul1 ID have more than 1 names
748Sam1 ID have more than 1 names
892Nat1 ID per 1 Name

 

Thank you.

  • Hi,

    Please check the below picture and the attached pbix file.

     

     

    Expected result CC =
    VAR _condition =
        COUNTROWS (
            SUMMARIZE ( FILTER ( Data, Data[ID] = EARLIER ( Data[ID] ) ), Data[Name] )
        ) = 1
    RETURN
        IF ( _condition, "ID per 1 name", "ID have more than 1 names" )
    

4 Replies

  • Hi,

    Please check the below picture and the attached pbix file.

     

     

    Expected result CC =
    VAR _condition =
        COUNTROWS (
            SUMMARIZE ( FILTER ( Data, Data[ID] = EARLIER ( Data[ID] ) ), Data[Name] )
        ) = 1
    RETURN
        IF ( _condition, "ID per 1 name", "ID have more than 1 names" )
    
    • NSBS's avatar
      NSBS
      Helper I

      Hi Jihwan_Kim ,

       

      Thank you for your solution. It is working. Really appreciation your support and time

      • NSBS's avatar
        NSBS
        Helper I

        Hi Jihwan_Kim ,

         

        Can you help to provide M code equivalent to the DAX code that you provided before?

    • NSBS's avatar
      NSBS
      Helper I

      Hi Jihwan_Kim ,

       

      Currently I'm in the need of the M code for this row comparison as well. I have try to create it but no output.

      Kindly help on this matter.

       

      Thank you.