Forum Discussion
bernate
2 years agoHelper III
Get 2nd Result from Merge Queries
Hello, I am using Merge Queries in Power BI as a VLOOKUP to get the resulting row value based on the columns I am matching on. Table 1 contains the names of people, Table 2 contains the names and the...
- Anonymous2 years ago
I would do it like this:
let
Source = Table.NestedJoin(Table1, {"Name"}, Table2, {"Name"}, "Table2", JoinKind.LeftOuter),
#"Added Custom" = Table.AddColumn(Source, "Department 1", each [Table2]{0}[Department]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Department 2", each try [Table2]{1}[Department] otherwise null),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom1",{"Table2"})
in
#"Removed Columns"--Nate
Ahmedx
2 years agoSuper User
pls try this
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTJUitWJVrowCcg0gjAXApnGCCZQNBYA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Department = _t]),
group = Table.Group(Source, "Name", {"tmp",
(x)=> [ a = x[Department],
b = Table.FromRows( {a}, List.Transform({1..List.Count(a)},(x)=>"Department"& Text.From(x)))
][b]
}),
#"Expanded tmp" = Table.ExpandTableColumn(group, "tmp", {"Department1", "Department2"})
in
#"Expanded tmp"