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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
erhan_79
Post Prodigy
Post Prodigy

Merge Question

Hi there ;

 

İ have two tables as below Table A and Table B , just i want to create lookup , and on table B i want  to see currency , but when i use merge sytem gives me 8 rows data as i attached "merged data" picture , i merged the data according to " Keycode" columns

 

TABLE A 

Capture1.JPG

 

TABLE B

Capture2.JPG

 

Merged Data :

 

Capture4.JPG

 

as you see system creating 8 rows and duplicating somethings , i just would like to lookup value as below but on query side , how can i create  a lookup for currency as below on query side ? can you help me ?

 

Capture6.JPG

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @erhan_79 ,

 

make a copy of Table A and group it by keycode and currency.

This should then be your lookup table.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

4 REPLIES 4
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @erhan_79 ,

 

make a copy of Table A and group it by keycode and currency.

This should then be your lookup table.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


FrankAT
Community Champion
Community Champion

Hi @erhan_79,

in Power Query you can do it like this:

 

// TableA
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQzMNQzMjC0UNJRMjE1NjRIBDJA2NAURBgYAMnU0iKlWJ1oJSOcag0w1BqjqTVMAjJA2MgATIDI0uIUsFoTXGqN0dTGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, #" Keycode Material Order Qty Value" = _t, #"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
    #"Renamed Columns" = Table.RenameColumns(Source,{{" Keycode Material Order Qty Value", "Keycode"}, {"(blank)", "Material"}, {"(blank).1", "Order Qty"}, {"(blank).2", "Value"}, {"(blank).3", "Currency"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}, {"Order Qty", Int64.Type}, {"Value", Int64.Type}})
in
    #"Changed Type"


// TableB
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjLQMzDXMzIwMlDSUTIxNTY0SAQyQNjUVClWB6jACJcCM6gCYzQFhklABgibQxWY4lJgYaAUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date<u+202d> = _t, #"<u+202c>Keycode" = _t, Material = _t, Qty = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date<u+202d>", type date}, {"Qty", Int64.Type}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"<u+202c>Keycode"}, TableKeyCode, {"Keycode"}, "TableA (2)", JoinKind.LeftOuter),
    #"Expanded TableA (2)" = Table.ExpandTableColumn(#"Merged Queries", "TableA (2)", {"Currency"}, {"Currency"})
in
    #"Expanded TableA (2)"


// TableKeyCode
let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQzMNQzMjC0UNJRMjE1NjRIBDJA2NAURBgYAMnU0iKlWJ1oJSOcag0w1BqjqTVMAjJA2MgATIDI0uIUsFoTXGqN0dTGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, #" Keycode Material Order Qty Value" = _t, #"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
    #"Renamed Columns" = Table.RenameColumns(Source,{{" Keycode Material Order Qty Value", "Keycode"}, {"(blank)", "Material"}, {"(blank).1", "Order Qty"}, {"(blank).2", "Value"}, {"(blank).3", "Currency"}}),
    #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type date}, {"Order Qty", Int64.Type}, {"Value", Int64.Type}}),
    #"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"Keycode", "Currency"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Other Columns", {"Keycode"})
in
    #"Removed Duplicates"rrency"}}),
    #"Changed Ty

Regards FrankAT#"(blank)" = _t, #"(blank).1

jdbuchanan71
Super User
Super User

@erhan_79   Add a column to your table B like so.

Curr = LOOKUPVALUE ( 'Table A'[Currency], 'Table A'[Keycode], 'Table B'[Keycode] )

@jdbuchanan71 

 

thank you but , i want to create new colum on query side , i think you gave me DAX formula 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.