Forum Discussion

dub's avatar
dub
Frequent Visitor
9 years ago
Solved

Dynamicaly pull data from other tables based on a field value


I have a table Combine and tables Table 1, Table 2, Table 3, ... Table 10.


Each of the tables Table 1, ... Table 10 has one row with multiple columns. Lets say on of the columns is Table1[Id] and the other is Table1[Number].


The table Combine has a column Combine[Id], which is a list of Ids from Table1,...Table 10.


Now i need to create a new column Combine[Values] which will dynamicaly pull the data from Table 1[Number]...Table 10[Number] into the column Combine[Values] based on the matching Ids.



F.ex.


If,


Table1[Id]=1 and Table1[Number]=111

Table2[Id]=2 and Table2[Number]=222


Table Combine should look like:


ID  Value

1    111

2    222


Can anyone help, please?

Thank you very much.

  • Hi dub,

     

    After loading all these tables (Combine, Table1, Table2,...Table10) into Power BI desktop, you should first Append tables from Table1 to Table10 in Query Editor mode. Suppose the new appended table is called Table11, then, in report view mode, you can use LookUpValue function to  create a new calculated column Combine[Values] in Combine Table.

     

    Values=LOOKUPVALUE(Table11[Number], Table11[Id], Combine[Id])

     

    Best regards,
    Yuliana Gu

2 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi dub,

     

    After loading all these tables (Combine, Table1, Table2,...Table10) into Power BI desktop, you should first Append tables from Table1 to Table10 in Query Editor mode. Suppose the new appended table is called Table11, then, in report view mode, you can use LookUpValue function to  create a new calculated column Combine[Values] in Combine Table.

     

    Values=LOOKUPVALUE(Table11[Number], Table11[Id], Combine[Id])

     

    Best regards,
    Yuliana Gu

    • dub's avatar
      dub
      Frequent Visitor

      Thanks. It did the work :)