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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Merge Error: entire second query source is coming through; not the second query result

I have two queries "firstQuery" and "secondQuery"; they are both loaded to Connection Only. When I merge queries as new and then expand the table of the secondQuery, the entire source of secondQuery comes through instead of the final result of secondQuery. See example below.

 

firstQuery (result; after operations on the source):

firstQuery_column_1firstQuery_column_2
abc123

 

secondQuery (source):

secondQuery_column_1secondQuery_column_2
abc789
def012

 

secondQuery (result; after operations on the source):

secondQuery_column_1secondQuery_column_2
abc789

 

 

Here's the problem:

When I merge as new (firstQuery and secondQuery) with Full Outer Join and firstQuery_column_1 = secondQuery_column_2 and then expand the "Table" of the merged secondQuery, the entire secondQuery(source) comes through instead of the secondQuery(result). However, when I select each row of the "Table" prior to expanding, it shows exactly the one value that I want from secondQuery(result).

firstQuery_column_1firstQuery_column_2secondQuery_column_1secondQuery_column_2
abc123abc789
  def012

 

I expected the secondQuery(result) to be merged, not the secondQuery(source). This is what I expected:

firstQuery_column_1firstQuery_column_2secondQuery_column_1secondQuery_column_2
abc123abc789

 

I understand left, right, full, inner, outer and anti joins. The example above could have been resolved with an inner join. However, my real application requires the full join.

 

Why/how is the secondQuery(source) even available for merging in this situation when I am only selecting the secondQuery(result)???

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

I can't reproduce your problem.  Maybe in your code is something wrong.  Maybe you can post here the m-code of your three queries.

Here the secenario where I tied to reproduce it

let
    Table1 = 
    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxKVtJRMjQyVoqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [firstQuery_column_1 = _t, firstQuery_column_2 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"firstQuery_column_1", type text}, {"firstQuery_column_2", Int64.Type}})
in
    #"Changed Type",
    Table2 = let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxKVtJRMrewVIrViVZKSU0D8gwMjZRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [secondQuery_column_1 = _t, secondQuery_column_2 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"secondQuery_column_1", type text}, {"secondQuery_column_2", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([secondQuery_column_1] = "abc"))
in
    #"Filtered Rows",


    Join= Table.NestedJoin
    (
        Table1,
        "firstQuery_column_1", 
        Table2,
        "secondQuery_column_1",
        "Table2",
        JoinKind.FullOuter
    ),
    #"Expanded Table2" = Table.ExpandTableColumn(Join, "Table2", {"secondQuery_column_1", "secondQuery_column_2"}, {"secondQuery_column_1", "secondQuery_column_2"})
in
    #"Expanded Table2"

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

2 REPLIES 2
Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

I can't reproduce your problem.  Maybe in your code is something wrong.  Maybe you can post here the m-code of your three queries.

Here the secenario where I tied to reproduce it

let
    Table1 = 
    let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxKVtJRMjQyVoqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [firstQuery_column_1 = _t, firstQuery_column_2 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"firstQuery_column_1", type text}, {"firstQuery_column_2", Int64.Type}})
in
    #"Changed Type",
    Table2 = let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxKVtJRMrewVIrViVZKSU0D8gwMjZRiYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [secondQuery_column_1 = _t, secondQuery_column_2 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"secondQuery_column_1", type text}, {"secondQuery_column_2", Int64.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([secondQuery_column_1] = "abc"))
in
    #"Filtered Rows",


    Join= Table.NestedJoin
    (
        Table1,
        "firstQuery_column_1", 
        Table2,
        "secondQuery_column_1",
        "Table2",
        JoinKind.FullOuter
    ),
    #"Expanded Table2" = Table.ExpandTableColumn(Join, "Table2", {"secondQuery_column_1", "secondQuery_column_2"}, {"secondQuery_column_1", "secondQuery_column_2"})
in
    #"Expanded Table2"

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

Thank you Jimmy, very helpful. As I was making up a test file to attach to this thread I also was not able to reproduce it. So then I went back to my actual dataset, started the query over and voila. Isn't that the way it goes sometime?! Thank you 1000x for your detailed reply!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors