Analysis Grid - Creating Custom Aggregations
In addition to the standard aggregations, you can create custom aggregations and save them to use again in the future. There are two different types of custom aggregates you can create in the Analysis Grid: column-specific and data type-specific.
Column-Specific Custom Aggregations
For this example, we want to determine the Average Item Cost. Using the data provided in the table below, you'll notice we need to incorporate a Tax Rate. This additional data component indicates that we cannot find the average by simply using a standard Sum or Average aggregation. Instead, we're going to create a Custom Aggregation to calculate the Average Item Cost.
To calculate this number, we need to first add a formula for Tax Amount (Order Amount * Tax Rate). Additionally, we need a formula that calculates the Average Item Cost (Order Amount/Item Count). These formulas will automatically display in your Data Table as additional columns. For more information about creating formulas in your Analysis Grid, see Analysis Grid - Adding Formula Columns.
If you're going to aggregate a Formula column (created by executing a calculation), the "order of operations" may be important. For example, should the Analysis Grid do the calculation first, then apply the aggregation, or apply the aggregation and then do the calculation? The choice can result in completely different results.
Once you've created your formulas, follow the steps below to create a custom aggregate:
- Select the gear icon to access the Aggregation feature:
Info displays the Table configuration options.
- Select the Aggregate tab.
- To add a Custom aggregation, select the Data Column to be aggregated from the column list.
- Then, select Aggregate Function > Custom. Info displays the Add a custom aggregation for (name of Data Column) pop-up window:
- Type a name for the Custom Aggregation.
- Customize the formula by utilizing the drop-down arrows to select a Column, Formula, and Operator.
- Select Add. Logi Info displays your custom aggregation in the Data Table and adds your new custom Aggregate Function to the drop-down list for future use:
- You can turn the custom aggregation on/off by selecting the column header > Aggregations > Remove (Custom Agg):
- To edit your Custom Aggregation, select the Aggregation hyperlink in the Aggregates section:
Info displays the Add a custom aggregation pop-up window.
- Manage the list of custom aggregates by selecting the adjacent Replace button or trash can icon.
Data Type-Specific Custom Aggregation
The other type of custom aggregate you can create in your Analysis Grid are applied to a specific data type(s).
- Begin by selecting the gear icon to access the Aggregation feature:
Info displays the Table configuration options.
- Select the Aggregate tab.
- Select All from the Data Column drop-down list.
- Then, select Aggregate Function > (Custom). Logi Info displays the Add a custom aggregation for the selected data type (s) pop-up window:
- Type a name for the Custom Aggregation.
- Customize the formula by entering your formula, or, utilize the drop-down arrows to select a Column, Formula, and Operator. Data type-specific Custom Aggregates use a @CurrentColumn token as a column reference and replace the column on which it's applied, as shown below. Reminder that you cannot apply a sum or count aggregate on a variable character field or text column.
- Select the All Data Type check box, or select individual data type(s) to apply the custom aggregate:
You must select at least one check box to create the aggregate. Selecting all ensures that the custom aggregate is applied to all of the columns.
- Select Create. Info displays your custom aggregation in the Data Table and adds your new custom Aggregate Function to the drop-down list for future use.
- You can turn the custom aggregation on/off by selecting the column header > Aggregations > Remove (Custom Agg).
- To edit your Custom Aggregation, select the Aggregation hyperlink in the Aggregates section:
Info displays the Add a custom aggregation pop-up window.
- Manage the list of custom aggregates by selecting the adjacent Replace button or trash can icon.