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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Merge tables, adding new values

Dear community,

I need a help merging two tables yet adding new values, as shown in the picture below

inDiana_0-1637574989558.png

The Stock table should be left outer join. So the new tables should include all values from table Stock, respective Inbound for matched articles and new articles from table Inbound with respective values.

Would be grateful for any tips! 

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

let
    Stock = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJSitWJVnKCs5whrFgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Article = _t, Stock = _t]),
    Inbound = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitWJVnKGs1zgLDcIKxYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Article = _t, Inbound = _t]),
    #"Merged Queries" = Table.NestedJoin(Stock, "Article", Inbound, "Article", "In", JoinKind.FullOuter),
    #"Expanded In" = Table.ExpandTableColumn(#"Merged Queries", "In", {"Article", "Inbound"}, {"Article.1", "Inbound"}),
    #"Combined Columns" = Table.CombineColumns(#"Expanded In", {"Article.1", "Article"}, each if _{0} = _{1} then _{0} else _{0}??"" & _{1}??"", "Article")
in
    #"Combined Columns"

Screenshot 2021-11-22 113421.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

thanks for help everyone!

CNENFRNL
Community Champion
Community Champion

let
    Stock = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJSitWJVnKCs5whrFgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Article = _t, Stock = _t]),
    Inbound = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitWJVnKGs1zgLDcIKxYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Article = _t, Inbound = _t]),
    #"Merged Queries" = Table.NestedJoin(Stock, "Article", Inbound, "Article", "In", JoinKind.FullOuter),
    #"Expanded In" = Table.ExpandTableColumn(#"Merged Queries", "In", {"Article", "Inbound"}, {"Article.1", "Inbound"}),
    #"Combined Columns" = Table.CombineColumns(#"Expanded In", {"Article.1", "Article"}, each if _{0} = _{1} then _{0} else _{0}??"" & _{1}??"", "Article")
in
    #"Combined Columns"

Screenshot 2021-11-22 113421.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

amitchandak
Super User
Super User

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.