Forum Discussion

Mangnuel's avatar
Mangnuel
Helper I
1 year ago
Solved

Merging two tables

Ey Power-Bi world,   I need help please 😊 Topic or Task: Merge / Combining two tables with given rules I need to combine two different tables. First table looks like this Date, Asset...
  • gmsamborn's avatar
    1 year ago

    Hi Mangnuel 

    In this case, you should be able to use “Merge Queries as New”.

    In Power Query:

    1. Select your Table1 and in the Combine section of the Home menu, select Merge Queries As New.
    2. In the Merge window, select Table 2 as the second table.  Select the common columns in each table ( Date and Asset-Code ) using the CTRL key, and hit OK.
    3. In the Merge1 table, expand the Table 2 column, and select ONLY Yield Utility and hit OK.
    4. In the new Yield Utility column, filter out the null values.

    Let me know if you have any questions.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the reply from tharunkumarRTK and gmsamborn , please allow me to provide another insight: 
    Hi  Mangnuel ,

     

    Here are the steps you can follow:

    1. Create calculated table.

    Table =
    ADDCOLUMNS(
        'Table 1',
        "Yield Utility",
        SUMX(
            FILTER(ALL('Table 2'),
        'Table 2'[Date]=EARLIER('Table 1'[Date])&&
        'Table 1'[Asset-Code]=EARLIER('Table 1'[Asset-Code])),[Yield Utility]))

    2. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly