如果我有以下来源:
#"My Source" = Table.FromRecords({
[Name="Jared Smith", Age=24],
[Name = "Tom Brady", Age=44],
[Name="Hello Tom", Age = null],
[Name = "asdf", Age = "abc"]
}),
例如,如何从值列表中添加新列:
Table.AddColumn(#"My Source", "New Col", {'x', 'y', 'z', null})
现在我的表将有三列。如何做到这一点?
我是PQ初学者,所以可能会有更有效的方法,但这是一个:
let
Source1 = Table.FromRecords({
[Name="Jared Smith", Age=24],
[Name = "Tom Brady", Age=44],
[Name="Hello Tom", Age = null],
[Name = "asdf", Age = "abc"]
}),
#"Added Index" = Table.AddIndexColumn(Source1, "Index", 0, 1),
Source2 = Table.FromRecords({
[New="x"],
[New = "y"],
[New = "z"],
[New = null]
}),
#"Added Index2" = Table.AddIndexColumn(Source2, "Index", 0, 1),
Merge = Table.Join(#"Added Index", "Index",#"Added Index2", "Index"),
#"Removed Columns" = Table.RemoveColumns(Merge,{"Index"})
in
#"Removed Columns"