Table.Unpivot

Sözdizimi

Table.Unpivot(table as table, pivotColumns as list, attributeColumn as text, valueColumn as text) as table

Hakkında

Tablodaki bir sütun kümesini öznitelik-değer çiftlerine çevirir ve her satırdaki değerlerin geri kalanıyla birleştirilir.

Örnek 1

Tablodaki ({[ key = "x", a = 1, b = null, c = 3 ], [ key = "y", a = 2, b = 4, c = null ]}) "a", "b" ve "c" sütunlarını alın ve bunları öznitelik-değer çiftleri halinde açın.

Kullanım

Table.Unpivot(
    Table.FromRecords({
        [key = "x", a = 1, b = null, c = 3],
        [key = "y", a = 2, b = 4, c = null]
    }),
    {"a", "b", "c"},
    "attribute",
    "value"
)

Çıkış

Table.FromRecords({
    [key = "x", attribute = "a", value = 1],
    [key = "x", attribute = "c", value = 3],
    [key = "y", attribute = "a", value = 2],
    [key = "y", attribute = "b", value = 4]
})