在 power bi 中展开包含列表和日期的列
Expand column which has list and date in power bi
我有一个包含日期和日期列表的列。
我需要扩展该列,以便列表下的日期列表与列中的日期一起扩展。
我使用了下面的代码并得到了“Expression.Error:我们无法将类型列表的值转换为类型 Table。
细节:
值=[列表]
类型=[类型]"
Table.TransformColumns([Custom],{{[Custom],each if Value.Is(_,type list) then _ else {_}}})
生成列表的代码
= Table.AddColumn(#"Removed Blank Rows", "New end date", each let StDt = [#"Grant date #(lf)(dd/mm/yyyy)"],
根据您的代码扩展列表的代码。
Table.AddColumn(#"Added Custom", "Custom.1", each Table.TransformColumns([New end date]{{[New end date],each if Value.Is(_,type list) then _ else {_}}}))
这会将 non-list 行转换为列表,以便显示箭头选项
x = Table.TransformColumns(#"PriorStepName", {{"Custom", each if Value.Is(_, type list) then _ else {_} }} )
然后使用列顶部的箭头展开。然后改变类型
前图:
图片后
完整示例代码
let Source = #table({"a"}, {{"10/1/2020"},{"4/1/2020"},{"6/1/2020"},{"1/1/2020"},{"10/4/2020"},{"10/8/2020"}}),
z = {"5/31/2021","5/15/2020","3/14/2019"},
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if [Index]<2 then z else [a], type any),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
// prior is just to set up sample data
x = Table.TransformColumns(#"Removed Other Columns", {{"Custom", each if Value.Is(_, type list) then _ else {_} }} ),
#"Expanded Custom" = Table.ExpandListColumn(x, "Custom"),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}})
in #"Changed Type"
我有一个包含日期和日期列表的列。
我使用了下面的代码并得到了“Expression.Error:我们无法将类型列表的值转换为类型 Table。 细节: 值=[列表] 类型=[类型]"
Table.TransformColumns([Custom],{{[Custom],each if Value.Is(_,type list) then _ else {_}}})
生成列表的代码
= Table.AddColumn(#"Removed Blank Rows", "New end date", each let StDt = [#"Grant date #(lf)(dd/mm/yyyy)"],
根据您的代码扩展列表的代码。
Table.AddColumn(#"Added Custom", "Custom.1", each Table.TransformColumns([New end date]{{[New end date],each if Value.Is(_,type list) then _ else {_}}}))
这会将 non-list 行转换为列表,以便显示箭头选项
x = Table.TransformColumns(#"PriorStepName", {{"Custom", each if Value.Is(_, type list) then _ else {_} }} )
然后使用列顶部的箭头展开。然后改变类型
前图:
图片后
完整示例代码
let Source = #table({"a"}, {{"10/1/2020"},{"4/1/2020"},{"6/1/2020"},{"1/1/2020"},{"10/4/2020"},{"10/8/2020"}}),
z = {"5/31/2021","5/15/2020","3/14/2019"},
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each if [Index]<2 then z else [a], type any),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Custom"}),
// prior is just to set up sample data
x = Table.TransformColumns(#"Removed Other Columns", {{"Custom", each if Value.Is(_, type list) then _ else {_} }} ),
#"Expanded Custom" = Table.ExpandListColumn(x, "Custom"),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}})
in #"Changed Type"