Aggregation functions calculate a scaler value such as maximum, minimum, count, or sum for all rows in the column by using the expression.
Rubiscape lets you use the aggregation function by creating separate calculated columns for each expression.
Rubiscape offers the following aggregation methods:
- Count
- Max
- Mean
- Min
- Nunique
- Sum
You can create a calculated column that calculates the ratio of the Sum of Profit by Count of Segment.
To use the aggregation method to calculate the ratio follow the steps below
- To add a calculated column, From the Data panel select horizontal ellipse and select Add Calculated Column.
- Code Editor window appears. Enter the name for the column and enter the Expression. Validate the expression. After successful validation, select Add.
Here, we created the ProfitSum column with Expression >>
Agg([Profit], aggregationMethod = "sum"). - Similarly, create a new calculated column. Here, we add the column with the name SegmentCount with the Expression >>
Agg([Segment], aggregationMethod = "count") - Now, let’s add a new column to calculate the ratio between the two aggregated columns. Here we added a new calculated column as Ratio with the Expression >> [ProfitSum] / [SegmentCount].
- Finally, we added a Table widget and a Card widget to the Dashboard canvas to display the result.
The following screenshot shows the result.