Forum Discussion

Bullmasta's avatar
Bullmasta
Frequent Visitor
2 years ago
Solved

Create connection and condition between 2 tables through 1 common column

Hello all,    I am trying to merge 2 tables when the only connection is 1 column between them. I've tried the merge option but seems to be creating millions of combinations and that's probably a si...
  • dufoq3's avatar
    2 years ago

    Hi Bullmasta, you can merge tables which give you this result:

     

    If you want to achieve something else, provide expected result based on sample data please (at least screenshot)

     

    let
        Table1 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8kvMTTVU0lHKLyjJzM8DsVzz0nMyizOArEilWB1sKtyKUvOSQQr8EAoUUFS4pxblJuahqDAiaIkRIUuMCNlhDFdghMMOVBVY7EBVALcDaEIsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Type = _t, Language = _t, Included = _t]),
        Table2 = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCvVW0lFyzUvPySzOALIUgNi/oCQzP89QKVYHLp2Tji5tBJZ2K0rMS07FawJciVtRal5yBopa/OpQLIsFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Country = _t, Language = _t, Language2 = _t, Type2 = _t]),
        Table2_LowerCasedOptions = Table.TransformColumns(Table2,{{"Type2", Text.Lower, type text}}),
        #"Merged Queries" = Table.NestedJoin(Table1, {"Type"}, Table2_LowerCasedOptions, {"Type2"}, "Table2_LowercasedOptions", JoinKind.LeftOuter)
    in
        #"Merged Queries"