Forum Discussion

u4us1923's avatar
u4us1923
Frequent Visitor
1 year ago
Solved

Get value from another table with multiple conditions.

Hello. I have two tables as below. I want to create a custom column (Total Calls) in table2 and if the city and location values are equal, I want to add the count data in table1 to the Total Calls column in table2. How can I do this in powerquery?

 

 

 

  • When you are merging the 2 tables in power query, you need to select both "city" and "location" by holding the CTRL key in order to select both. Do the same for table 2. You need to join on these two columns.

     

6 Replies

  • mussaenda's avatar
    mussaenda
    Community Champion

    Hi u4us1923 ,

     

    We can do this with simple merge and select 2 columns for each table.

    • u4us1923's avatar
      u4us1923
      Frequent Visitor

      I have shown it as simple. normally there are too many columns in Table1... the columns of both tables are not the same unfortunately

      • mussaenda's avatar
        mussaenda
        Community Champion

        Hi u4us1923 ,

         

        it is not limited only for 2 columns, you can select as many columns as you want to merge them

  • mermanahan's avatar
    mermanahan
    Frequent Visitor

    When you are merging the 2 tables in power query, you need to select both "city" and "location" by holding the CTRL key in order to select both. Do the same for table 2. You need to join on these two columns.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi u4us1923 ,

     

    Here is the procedure. Please refer to mermanahan's response to holding CTRL key while selecting multiple columns.

    The pbix file is attached for reference.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum