Aggregates
Aggregates perform a calculation over an entire column, and are displayed when
one or more Group By are applied to the View
. Aggregates can be
specified by the user, or Perspective will use the following sensible default
aggregates based on column type:
- "sum" for
integer
andfloat
columns - "count" for all other columns
Perspective provides a selection of aggregate functions that can be applied to
columns in the View
constructor using a dictionary of column name to aggregate
function name.
const view = await table.view({
aggregates: {
a: "avg",
b: "distinct count",
},
});
view = table.view(
aggregates={
"a": "avg",
"b": "distinct count"
}
)