Forum Discussion
How to join a table with a subquery using power query M
- 7 years ago
I don't see why not, it's M code, you can pretty much do whatever you want. See my technique here:
https://social.technet.microsoft.com/wiki/contents/articles/32915.power-bi-merge-query-with-m.aspx
- 7 years ago
Well, if you don't want to write M code to keep it all in one query, you could simply create a new reference query to Table1. Right click Table1 query and choose "Reference". Then in that query right-click the EmpID column and choose to remove duplicates. Then just use that table in your merge query. Or you could just write those steps in M and keep it all in a single query without creating the table, but however you want to do it. For example something like this would probably work:
= Table.NestedJoin(Table.Distinct(Table1,{"EmpID"}),{"EmpID"},Table2,{"EmpID"},"Table2",JoinKind.LeftOuter)
Well, if you don't want to write M code to keep it all in one query, you could simply create a new reference query to Table1. Right click Table1 query and choose "Reference". Then in that query right-click the EmpID column and choose to remove duplicates. Then just use that table in your merge query. Or you could just write those steps in M and keep it all in a single query without creating the table, but however you want to do it. For example something like this would probably work:
= Table.NestedJoin(Table.Distinct(Table1,{"EmpID"}),{"EmpID"},Table2,{"EmpID"},"Table2",JoinKind.LeftOuter)Hey Greg,
How can we join via nestedjoin on multiple condition but with or conditrion.
Example: Select A.id ,A.Name B.Name,B.Course from A, B where (A.id=B.id Or A.Name = B.Name).
I was trying to do it using Merge query , I am able to select multiple column when joining from but A and B but I think it is taking And operator.