我在Power Query中有一个SharePoint列表作为数据源。
它有一个"AttachmentFiles“列,也就是一个表,在这个表中,我想要列"ServerRelativeURL”中的值。

我想拆分这一列,这样“ServerRelativeURL”中的每个值都有自己的列。

如果我使用expand table函数,我可以得到值,但它会将它分成多行,我想将它保留在一行中。

我希望每个唯一的ID只有一行。
示例:

我可以接受固定数量的列,因为每个ID通常不超过3个附件。
我想我可以添加一个引用"AttachmentFiles ServerRelativeURL Value(1)“的自定义列,但我不知道如何添加。
有人能帮上忙吗?
发布于 2020-05-18 20:08:31
我一定要自己解决它。
我添加了3个自定义列,如CustomColumn1:[AttachmentFiles]{0} CustomColumn2:[AttachmentFiles]{1} CustomColumn3:[AttachmentFiles]{2}
并仅在选择了"ServerRelativeURL“的情况下展开它们。如果有一个动态的解决方案就好了。但现在这将会工作得很好。
发布于 2020-05-18 18:33:11
尝试以下代码:
let
fn = (x)=> {x, #table({"ServerRelativeUrl"},List.FirstN(List.Zip({{"a".."z"}}), x*2))},
Source = #table({"id", "AttachmentFiles"},{fn(2),fn(3),fn(1)}),
replace = Table.ReplaceValue(Source,0,0,(a,b,c)=>a[ServerRelativeUrl],{"AttachmentFiles"}),
cols = List.Transform({1..List.Max(List.Transform(replace[AttachmentFiles], List.Count))}, each "url"&Text.From(_)),
split = Table.SplitColumn(replace, "AttachmentFiles", (x)=>List.Transform({0..List.Count(x)-1}, each x{_}), cols)
in
split

https://stackoverflow.com/questions/61865165
复制相似问题