Udostępnij za pośrednictwem


Table.ExpandListColumn

Składnia

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

Informacje

Biorąc pod uwagę, gdzie tablecolumn zawiera listę wartości, dzieli listę na wiersz dla każdej wartości. Wartości w innych kolumnach są duplikowane w każdym nowym wierszu utworzonym. Ta funkcja może również rozszerzać zagnieżdżone tabele, traktując je jako listy rekordów.

Przykład 1

Podziel kolumnę listy [Name].

Użycie

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

Wyjście

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

Przykład 2

Podziel kolumnę zagnieżdżonej tabeli [Components].

Użycie

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

Wyjście

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