Forum Discussion

u4us1923's avatar
u4us1923
Frequent Visitor
1 year ago
Solved

getting the data from the specific row in the other query when creating a custom column

Hello  I have two tables as below. I'd like to create new custom column (z) in Table2 and add a specific data from Table1.   I couldn't find anything on how I can do this... can you please help me...
  • Akash_Varuna's avatar
    1 year ago

    Hi u4us1923 Please Follow these 

    • Add a Custom Column in Table2

      • In Table2, add a custom column that references a specific value from Table1.
      • Go to the Add Column tab and select Custom Column.
    • Use Power Query Formula

      • Use the following formula to extract the value from Table1:
        Table.SelectRows(Table1, each [City] = "NewYork"){0}[Count]
        • Replace "NewYork" with the specific logic for your lookup.
        • {0} selects the first matching row.
    • Expand the Logic for Dynamic Lookup

      • To make it dynamic, you can match the rows based on conditions.
        Table.SelectRows(Table1, each [City] = [Y] and [Country] = "USA"){0}[Count]
        If this post helped please do give a kudos and accet this as a solution
        Thanks In Advance
  • v-csrikanth's avatar
    1 year ago

    Hi u4us1923 
    It's been a while since I heard back from you and I wanted to follow up. Have you had a chance to try the solutions that have been offered?
    If the issue has been resolved, can you mark the post as resolved? If you're still experiencing challenges, please feel free to let us know and we'll be happy to continue to help!
    Looking forward to your reply!

    If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.

    Best Regards,
    Community Support Team _ C Srikanth