Column Aggregations
Create new numeric columns using row-wise math: add, subtract, multiply, divide, modulus, exponent, logarithm, or percentages across columns and constants.
Column Aggregations creates a new numeric column by applying a math operation between a primary column and one or more secondary columns or constants. The operation is applied row by row across the entire dataset. The result is stored in a new column you name. The source columns are unchanged.
Only numeric columns are available as inputs. The output column is always Float64.
When to Use Column Aggregations
- Profit margin. Subtract
costfromrevenueto create aprofitcolumn, then divide byrevenueto getmargin_pct. - Growth rate. Subtract last period revenue from this period, divide by last period, multiply by 100 to get
growth_rate_pct. - Weighted scores. Multiply a score column by a weight column to derive a
weighted_score. - Unit economics. Divide
total_revenuebyorder_countto getrevenue_per_order. - Normalizing values. Divide a column by its known maximum to produce a 0-1 normalized version.
Sample Dataset
The examples in this doc use the Edilitics sample orders dataset. Download it to follow along in your own workspace.
edilitics_sample_orders.csv
Sample orders dataset for hands-on practice · 500 rows
Relevant columns for Column Aggregations examples:
Prop
Type
The Eight Operations
Adds the primary column and one or more secondary columns or constants, row by row.
result = primary + secondary1 + secondary2 + ...
| revenue | shipping_cost | result (profit_gross) |
|---|---|---|
| 780.62 | 12.50 | 793.12 |
| 4703.29 | 8.00 | 4711.29 |
Secondary Input accepts multiple columns and constants simultaneously.
Subtracts each secondary input from the running result, left to right.
result = primary - secondary1 - secondary2 - ...
| revenue | cost | result (profit) |
|---|---|---|
| 780.62 | 540.00 | 240.62 |
| 4703.29 | 3100.00 | 1603.29 |
Secondary Input accepts multiple columns and constants.
Multiplies the primary column by each secondary input sequentially.
result = primary * secondary1 * secondary2 * ...
| quantity | unit_price | result (total_value) |
|---|---|---|
| 5 | 156.12 | 780.62 |
| 30 | 156.78 | 4703.29 |
Use with a constant to scale a column: multiply revenue by 1.1 to add 10%.
Divides the running result by each secondary input sequentially.
result = primary / secondary1 / secondary2 / ...
| revenue | order_count | result (revenue_per_order) |
|---|---|---|
| 780.62 | 5 | 156.12 |
| 4703.29 | 30 | 156.78 |
Division by zero produces null for that row. Check the preview for unexpected nulls.
Returns the remainder after dividing the primary column by a single secondary value.
result = primary % secondary
| order_id_numeric | result (remainder_mod_100) |
|---|---|
| 1001 | 1 |
| 1050 | 50 |
Secondary Input accepts a single column or constant. Useful for bucketing by remainder or checking divisibility.
Raises the primary column to the power of a single secondary value.
result = primary ^ secondary
| value | result (value_squared) |
|---|---|
| 4.0 | 16.0 |
| 2.5 | 6.25 |
Secondary Input accepts a single column or constant. Use a constant 2 to square, 0.5 for square root.
Computes the logarithm of the primary column using a fixed base.
result = log_base(primary)
Secondary Input shows a fixed dropdown with four options:
| Option | Base |
|---|---|
| Log e | 2.71828 (natural log) |
| Log 2 | 2 |
| Log 10 | 10 |
| Log 16 | 16 |
Values of 0 or negative produce null. Log is commonly used to compress wide-range numeric columns for modeling or visualization.
Expresses the primary column as a percentage of a single secondary value.
result = (primary / secondary) * 100
| profit | revenue | result (margin_pct) |
|---|---|---|
| 240.62 | 780.62 | 30.83 |
| 1603.29 | 4703.29 | 34.09 |
Secondary Input accepts a single column or constant.
How to Apply Column Aggregations
Open the Column Aggregations operation
In your Transform pipeline, click Add Operation and select Column Aggregations from the operation list.
If your dataset has no numeric columns, a toast will appear and the operation will close automatically.
Select a Primary Column
Choose the starting column for your calculation. Only numeric columns appear in this dropdown.
Choose an Operation
Select from: Add, Subtract, Multiply, Divide, Modulus, Exponent, Logarithm, Percentage. The Operation dropdown is disabled until a primary column is selected.
Set the Secondary Input
The Secondary Input field changes based on the operation:
- Add, Subtract, Multiply, Divide: multi-select. Choose one or more columns or type a constant number.
- Modulus, Exponent, Percentage: single select. Choose one column or constant.
- Logarithm: fixed dropdown. Choose Log e, Log 2, Log 10, or Log 16.
Name the Output Column
Type a name for the new column in the Output Column Name field. The name must:
- Contain only letters, numbers, and underscores
- Not start with
__or a number - Not already exist in the dataset or in another aggregation configured in this operation
Click Done to add this aggregation
Click Done to add the aggregation to the list above the configuration panel. The output column name is now available as a secondary input for additional aggregations in this operation.
To configure another aggregation, click Add Aggregation and repeat the steps above.
Save the operation
Click Save & Preview. Edilitics computes all configured aggregations and adds the new columns to the dataset. A success toast confirms: "Aggregation saved. Preview has been updated with the calculated column."
Verify in the preview
Check the new columns in the preview. Spot-check a few rows against manual calculations. Watch for unexpected nulls, which indicate division by zero or logarithm of a non-positive value.
Before and After
Two aggregations configured in one operation:
revenueSubtractcost=profitprofitPercentagerevenue=margin_pct
Note: profit (created in aggregation 1) is used as the primary column in aggregation 2.
Input:
| revenue | cost |
|---|---|
| 780.62 | 540.00 |
| 4703.29 | 3100.00 |
Output:
| revenue | cost | profit | margin_pct |
|---|---|---|---|
| 780.62 | 540.00 | 240.62 | 30.83 |
| 4703.29 | 3100.00 | 1603.29 | 34.09 |
Code Equivalent
SELECT
*,
revenue - cost AS profit,
((revenue - cost) / revenue) * 100 AS margin_pct
FROM orders;import polars as pl
df = df.with_columns([
(pl.col("revenue") - pl.col("cost")).alias("profit"),
]).with_columns([
((pl.col("profit") / pl.col("revenue")) * 100).alias("margin_pct"),
])After Save & Preview, the pipeline shows a DQ delta badge on this step - green if the table score improved, red if it dropped. See Data Quality Scoring for how scores are calculated.
After Save & Preview, the pipeline shows a DQ delta badge on this step - green if the table score improved, red if it dropped. See Data Quality Scoring for how scores are calculated.
Operation Reference
Prop
Type
Frequently Asked Questions
Next Steps
Round Off Values
Round the new float column to a specific number of decimal places.
Group By
Aggregate the new derived column by category to get sums or averages per group.
Filter
Filter rows based on the new derived metric column.
Conditional Column
Categorize rows based on the derived metric value using if/else logic.
Need help? Email support@edilitics.com with your workspace, job ID, and context. We reply within one business day.
Last updated on
Conditional Column
Add a new column whose value is set by IF/THEN rules evaluated top-to-bottom. First matching rule wins. Else value for unmatched rows. No code needed.
Bin / Discretize
Group continuous numerical values into labeled buckets using Equal Width, Quantile, or Custom Breaks visually without writing code in Edilitics Transform.