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.
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_1 | firstQuery_column_2 |
abc | 123 |
secondQuery (source):
secondQuery_column_1 | secondQuery_column_2 |
abc | 789 |
def | 012 |
secondQuery (result; after operations on the source):
secondQuery_column_1 | secondQuery_column_2 |
abc | 789 |
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_1 | firstQuery_column_2 | secondQuery_column_1 | secondQuery_column_2 |
abc | 123 | abc | 789 |
def | 012 |
I expected the secondQuery(result) to be merged, not the secondQuery(source). This is what I expected:
firstQuery_column_1 | firstQuery_column_2 | secondQuery_column_1 | secondQuery_column_2 |
abc | 123 | abc | 789 |
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)???
Solved! Go to Solution.
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
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
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!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.