Aggregations in Table and Chart Components

There are specific ways that you can take advantage of aggregations in both table and chart components.

In a Table Component

Column summaries

Summaries are a standard Table component element that appear at the bottom of a table’s column, and they display the result of an aggregation while disregarding groupings. Because of this, summaries are an excellent way to utilize the delineation of groupings while still displaying the whole picture of a model’s field data.

To select which summaries the column should display:

  1. In the table, click on the aggregated field.
  2. (Optional) In the field properties, create a Custom label for the field. This label will display at the top of the column.
  3. In Column summaries, click Select Summary Type(s) and choose the summary type(s) from the picklist:
    • Sum
    • Average
    • Min
    • Max
    • Median
  4. Click Save.

If more than one summary was selected, they will display in the order they are listed in the picklist.

Note

Column summary calculations are based on the rows in the model, a property set by the Max # of records (limit) field. For example, with Max # of records set to 5, only 5 rows—or groups of aggregations—would display in components. The summary would then only be performed on those 5 rows.

Warning

Do not use summaries when using the Rollup grouping method. Since the rollup is appended as an extra row within the model, summaries will use that extra row when performing their calculations. This can result in some erroneous calculations—like summing all the rows and then doubling that sum!

In a Chart Component

It’s possible to use a basic model with visualizations like charts, but basic models have different limits on the amount of data they query. If the chart has a very large record set, using a basic model may result in an inaccurate visualization; the page would likely benefit from an aggregate model.

Salesforce imposes a limit on how many records can be returned in a query. If a Skuid SFX page throws an Apex heap size error, this limit has been exceeded. Using an aggregate model is necessary for the visualization to display correctly: there’s simply too much data for a basic model.

Aggregations and charts

Charts are, in effect, aggregations of data made visual. The aggregation functions used by charts are similar to those used by aggregate models: average, sum, max, min, and count (there is no “count distinct” in charts).

If creating a page that uses multiple aggregate models and multiple series (which aggregate data) in a chart, then it’s critical that the Alias name for each aggregation in the aggregate model be unique.

For example, with two models that aggregate a SUM on an amount—even an amount from a different object—the default Alias Name for both of these aggregations will be sumAmount. If left this way, the Alias Names are not unique; this may cause one of the series in the chart to fail to render. This is easy to fix: edit the aggregate models to give each aggregation within the models a unique Alias name.

Best practice: When creating unique Alias Names, try to include content that identifies the purpose of the aggregation.

Want to learn more about using charts? Check out Visualizations: Charts and Graphs.