Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hi All,
I have 2 data sources and in both of them thare are columns NAME and ID. I would like to do a conditional join such as:
If NAME and ID are equal in both data sources join it based on these 2 columns; if not join it only based on NAME column.
If anybody can provide code from advance editor I would be very greatful.
Thanks
Solved! Go to Solution.
Try following code.
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Id", "Name"}, Table2, {"ID", "Name"}, "Table2", JoinKind.LeftOuter),
#"Merged Queries1" = Table.NestedJoin(#"Merged Queries", {"Name"}, Table2, {"Name"}, "Table2.1", JoinKind.LeftOuter),
#"Added Custom" = Table.AddColumn(#"Merged Queries1", "Custom", each if Table.RowCount([Table2]) > 0 then [Table2] else [Table2.1])
in
#"Added Custom"
Try following code.
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Id", "Name"}, Table2, {"ID", "Name"}, "Table2", JoinKind.LeftOuter),
#"Merged Queries1" = Table.NestedJoin(#"Merged Queries", {"Name"}, Table2, {"Name"}, "Table2.1", JoinKind.LeftOuter),
#"Added Custom" = Table.AddColumn(#"Merged Queries1", "Custom", each if Table.RowCount([Table2]) > 0 then [Table2] else [Table2.1])
in
#"Added Custom"
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.