Table.AggregateTableColumn
Syntax
Table.AggregateTableColumn(table as table, column as text, aggregations as list) as table
O nás
Agreguje tabulky v table
[column
] do více sloupců obsahujících agregované hodnoty pro tabulky.
aggregations
slouží k určení sloupců obsahujících tabulky, které se mají agregovat, agregační funkce, které se použijí pro tabulky, aby se vygenerovaly jejich hodnoty, a názvy agregovaných sloupců, které se mají vytvořit.
Příklad 1
Agregovat sloupce v [t]
v tabulce {[t = {[a=1, b=2, c=3], [a=2,b=4,c=6]}, b = 2]}
do součtu [t.a]
, minima a maxima [t.b]
a počtu hodnot v [t.a]
.
Využití
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"}
}
)
výstup
Table.FromRecords({[#"sum of t.a" = 3, #"min of t.b" = 2, #"max of t.b" = 4, #"count of t.a" = 2, b = 2]})