แชร์ผ่าน


Table.ExpandListColumn

ไวยากรณ์

Table.ExpandListColumn(table as table, column as text) as table

เกี่ยวกับ

tableกําหนด ที่ column ประกอบด้วยรายการค่า แยกรายการเป็นแถวสําหรับแต่ละค่า ค่าในคอลัมน์อื่น ๆ จะถูกทําซ้ําในแต่ละแถวใหม่ที่สร้างขึ้น ฟังก์ชันนี้ยังสามารถขยายตารางที่ซ้อนกัน โดยถือว่าเป็นรายการของเรกคอร์ด

ตัวอย่าง 1

แยกคอลัมน์รายการ [Name]

การใช้งาน

Table.ExpandListColumn(
    Table.FromRecords({[Name = {"Bob", "Jim", "Paul"}, Discount = .15]}),
    "Name"
)

เอาท์พุท

Table.FromRecords({
    [Name = "Bob", Discount = 0.15],
    [Name = "Jim", Discount = 0.15],
    [Name = "Paul", Discount = 0.15]
})

ตัวอย่าง 2

แยกคอลัมน์ตารางที่ซ้อนกัน[คอมโพเนนต์]

การใช้งาน

Table.ExpandListColumn(
    #table(
        {"Part", "Components"},
        {
            {"Tool", #table({"Name", "Quantity"}, {{"Thingamajig", 2}, {"Widget", 3}})}
        }
    ),
    "Components"
)

เอาท์พุท

Table.FromRecords({
    [Part = "Tool", Components = [Name = "Thingamajig", Quantity = 2]],
    [Part = "Tool", Components = [Name = "Widget", Quantity = 3]]
})