แชร์ผ่าน


Table.AggregateTableColumn

ไวยากรณ์

Table.AggregateTableColumn(table as table, column as text, aggregations as list) as table

เกี่ยวกับ

รวมตารางใน table[column] ลงในหลายคอลัมน์ที่ประกอบด้วยค่ารวมสําหรับตาราง aggregations จะถูกนํามาใช้เพื่อระบุคอลัมน์ที่มีตารางที่จะรวม ฟังก์ชันการรวมที่จะนําไปใช้กับตารางเพื่อสร้างค่าของตาราง และชื่อของคอลัมน์รวมที่จะสร้าง

ตัวอย่างที่ 1

รวมคอลัมน์ตารางใน [t] ในตาราง {[t = {[a=1, b=2, c=3], [a=2,b=4,c=6]}, b = 2]} เป็นผลรวมของ [t.a]ค่าต่ําสุดและค่าสูงสุดของ [t.b]และจํานวนของค่าใน[t.a]

การใช้งาน

Table.AggregateTableColumn(
    Table.FromRecords(
        {
            [
                t = Table.FromRecords({
                    [a = 1, b = 2, c = 3],
                    [a = 2, b = 4, c = 6]
                }),
                b = 2
            ]
        },
        type table [t = table [a = number, b = number, c = number], b = number]
    ),
    "t",
    {
        {"a", List.Sum, "sum of t.a"},
        {"b", List.Min, "min of t.b"},
        {"b", List.Max, "max of t.b"},
        {"a", List.Count, "count of t.a"}
    }
)

เอาท์พุท

Table.FromRecords({[#"sum of t.a" = 3, #"min of t.b" = 2, #"max of t.b" = 4, #"count of t.a" = 2, b = 2]})