Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Match values in a column with itself

Hi All,

 

I have a table with few columns. I want match fields in one column to match with itself and generate output. I can do it easily in Access by creating a copy of table and joining the respective fields to get the output. How can i do this in Power BI with the help of Dax.

 

Thanks in advance. 

13 Replies

  • Anonymous , you can use earlier. If you can give example what you want. We can help better

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Amit,

        

      Thanks for your reply. PLease see below screen shot. I want to match the 3 fields and add a column in one of the the tables and update it with Yes or No. 

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Icon for Community Champion rankCommunity Champion

    Anonymous try this in a calculated column

    = CONCATENATEX(FILTER(Table,Table[Filed1]=EARLIER(Table[Filed1])),Table.[Filed2],",")

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi wdx223_Daniel wdx223

        

      Thanks for your reply. PLease see below screen shot. I want to match the 3 fields and add a column in one of the the tables and update it with Yes or No. 

  • Anonymous , Something like this

    if(countx(filter(Table, [merchant_id] =earlier([merchant_id]) && [Day] =earlier([Day]) && [user_account_id] = earlier([user_account_id])),[id])+0 >1,"Yes","No")

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak : It doesn't seems to work. The two tables in the screenshot are identical tables. I just created a copy of one of the tables.  

      Yes/No is based on where:

      Merchant_Number = Merchant_Number(from 2nd table)

      and

      date = date(from 2nd table)

      and

      account_user_id = account_user_id(from 2nd table)

       

      • amitchandak's avatar
        amitchandak
        Icon for Super User rankSuper User

        Anonymous , new column in table 2

        if(countx(filter(Table, Table[merchant_id] =(Table2[merchant_id]) && Table[Day] =(Table2[Day]) && Table[user_account_id] = (Table2[user_account_id])),Table[id])+0 >1,"Yes","No")

         

        Refer the way to move value from one table to another https://www.youtube.com/watch?v=czNHt7UXIe8