Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

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:

JanikSchaefer_0-1655966687728.png

 

 

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 3
NickolajJessen
Solution Sage
Solution Sage

Fun challange

Good job for including table format data in your post!! 

https://drive.google.com/drive/folders/1AjePk7NUXAloXHr42BEa2lDOr5dQr2Wg

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! 🙂

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")

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.