Table.FromPartitions
Table.FromPartitions ( partitionColumn as text, partitions as list, optional partitionColumnType as nullable type) as table
返回为组合分区表 partitions
集的结果的表。partitionColumn
是要添加的列名称。列类型默认为 any
,但可以由 partitionColumnType
指定。
示例:
从列表 {number}
中找到项类型。
使用情况:
Table.FromPartitions(
"Year",
{
{
1994,
Table.FromPartitions(
"Month",
{
{
"Jan",
Table.FromPartitions(
"Day",
{
{
1,
#table({"Foo"},Bar)
},
{
2,
#table({"Foo"},Bar)
}
}
)
},
{
"Feb",
Table.FromPartitions(
"Day",
{
{
3,
#table({"Foo"},Bar)
},
{
4,
#table({"Foo"},Bar)
}
}
)
}
}
)
}
})
输出:
Table.FromRecords({ [
Foo = "Bar",
Day = 1,
Month = "Jan",
Year = 1994
], [
Foo = "Bar",
Day = 2,
Month = "Jan",
Year = 1994
], [
Foo = "Bar",
Day = 3,
Month = "Feb",
Year = 1994
], [
Foo = "Bar",
Day = 4,
Month = "Feb",
Year = 1994
]
}, {
"Foo",
"Day",
"Month",
"Year"
})