Forum Discussion

marisap's avatar
marisap
Regular Visitor
10 years ago
Solved

Using Data from One Table in Another Table

Hi There, 

 

I want to copy data from an imported Database Table and create a new table that includes the data from the imported table as well as additional columns that I would like to create my self. 

 

For example: 


I have an imported database table that includes numbers that are related to certain WAN Interfaces. However I want to create a table that includes the numbers but has them listed with more user friendly names as opposed to the long name that is included in the database. I want these numbers to update when I press refress and be related to the original Database Table so that they update. 

 

How can I do this? 

 

Thanks!

  • marisap

     

    In this scenario, you should have linked column between those two tables. Then you can go to Query Editor and use "Merge Queries" to combine the tables together. See: Shape and combine data in Power BI Desktop

     

    Another way is using DAX method. If you have built the relationships between these two tables, you can use RELATED() function to JOIN tables. Without relationship built, you can also use LOOKUPVALUE() to lookup that columns you need. For more information, please see: From SQL to DAX: Joining Tables.

     

    Regards,

6 Replies

  • ankitpatira's avatar
    ankitpatira
    Community Champion

    marisap You can do this by going to query editor in power bi desktop, right click your original table query and click Reference. Then add conditional columns to new created queries and when you hit refresh your original table will be refreshed and so will be the table with reference query.

  • v-sihou-msft's avatar
    v-sihou-msft
    Microsoft Employee

    marisap

     

    In this scenario, you should have linked column between those two tables. Then you can go to Query Editor and use "Merge Queries" to combine the tables together. See: Shape and combine data in Power BI Desktop

     

    Another way is using DAX method. If you have built the relationships between these two tables, you can use RELATED() function to JOIN tables. Without relationship built, you can also use LOOKUPVALUE() to lookup that columns you need. For more information, please see: From SQL to DAX: Joining Tables.

     

    Regards,

  • Hi, I was log  looking for similar answer, so I asked also chat gpt, so to gether we arrived to solution which works with provacy error, which you do disable in file -> privacy -> disable. 

     

    let
    // Connect to your data source and retrieve the names
    Source = ... // Your data source query or source data

    // Select the column containing names
    NamesColumn = Source[Name],

    // Convert the column to a list
    NamesList = List.Buffer(NamesColumn),

    // Create a text list with single quotes and commas
    NamesText = "'" & Text.Combine(NamesList, "','") & "'",

    // Connect to your data source again for the second query
    Source2 = ... // Your data source query or source data with WHERE clause using NamesText

    in
    Source2

    • JanisA0064's avatar
      JanisA0064
      New Member

      SELECT ... FROM ... ..WHERE  name IN (" &NamesText &")"])