Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Replace Values from Different tables

Hey Guys,

 

I need help with this query in M-code.

I have one table which has general data and is quite big and slow (Table1). I also have another table which has newer data, fast and shiny (Table2). I need a new table "Table3" which has all values and colums of Table1, but everytime Table2 and Table1 have the same column name, I need the "newer" value from Table 2.
Also, I need all columns from both Table1 and Table2

 

It should look like this:

 

 

Is there a fast way to do this


Thanks for your help, really appreciate it. 3 tables below.

 

Greetings,

Janik





Table1

IdentNoValue1Value2Value3Value21Value30
119689204515151006
259182754195716629
378421006129571
4503846629662984
5739409571957140
68675855723523
7523846334125125768
876892386023956
99565785423235

 Table 2

IdentNoValue1Value3Value21Value_New1
273912335123
4210068443433
5842321512152
64095712312

52422

Table3(Goal)

IdentNoValue1Value2Value3Value21Value30Value_New1
119689204515151006 
273982123356629123
378421006129571 
42841006848443433
58440232151240152
640589571231252352422
7523846334125125768 
876892386023956 
99565785423235 

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for your answers.

      I need a solution directly in M with a query in the end as I do this in Power BI Dataflows and need a data table like Table3.

      Any suggestions in M?

      Thanks! 🙂

      • NickolajJessen's avatar
        NickolajJessen
        Icon for Solution Sage rankSolution Sage

        Just pivot table2 it back to original format 🙂

        Add this to the last step on table 2:

         

        = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Attribute]), "Attribute", "Value")