Work with numbers Stay organized with collections Save and categorize content based on your preferences.
This page explains how to perform numeric calculations when you prepare data inthe Wrangler workspace of the Cloud Data Fusion Studio.
You can perform these transformations in columns of the following data types:
- Integer
- Decimal
- Double
- Float
- Long
- Short
For more information, see theset-column directive.
You can use numeric functions on one or more columns. The available numericfunctions vary by the number of columns you select. You can choose to create anew column with the results of the calculations, or you can have the resultsappear in the column where you add the transformation.
If you apply a numericfunction to a single column, the behavior is different than if you apply anumeric function to multiple columns. For example:
- If you use the
Multiply()function ona single column, you specify thedecimal value to multiply each value in the column by. Wrangler performs themultiplication on the sample data and displays the new values in the samecolumn or in a new column. - If you use the
Multiply()function onmultiple columns, Wranglermultiplies the values in each row for the selected columns and displays thenew values in the first column of the transformation.
Perform numeric calculations on values in one column
To apply a numeric calculation to one column, follow these steps:
- Go to the Wrangler workspace in Cloud Data Fusion.
- On theData tab, go to a column name and click thearrow_drop_downexpander arrow.
SelectCalculate and select an option—for example,Add.
To complete the calculation, some functions require you to enter a decimalvalue. For example, if you selectSubtract, you must enter the value tosubtract from each row.
Optional: to create a new column for the calculated values, select theCopy to a new column checkbox.
ClickApply.
The values change based on the calculation. Wrangler adds the correspondingdirective as a step in the recipe. For example, if you subtract two from eachvalue in thePrice column, Wrangler adds the following transformation to therecipe:
set-column :Price Price - 2When you run the data pipeline, the transformation is applied to all values inthe column.
Supported calculations for one column
You can perform the following calculations on all values in one column:
| Function | Description |
|---|---|
| Absolute value | Returns the absolute value for each value in a column. For example, the absolute value of -10 is 10. |
| Add | Adds a positive or negative decimal to a column or adds multiple columns to output the sum of each row. |
| Arccos | Returns the inverse of cosine for each value in a column. |
| Arcsin | Returns the inverse of sin for each value in a column. |
| Arctan | Returns the inverse of tangent for each value in a column. |
| Ceil | Returns the smallest integer greater than or equal to the numeric value in each cell of a column. For example, if the value is 2.21, Ceil returns 3. If the value is 5.88, Ceil returns 6. If the value is -5.15, Ceil returns -5. |
| Cos | Returns cosine of each column value. |
| Cube | Raises each value in the column to the power of 3. |
| Cube root | Returns the cube root of each value in the column. |
| Divide | Divides each value in the column by a positive or negative decimal or divides each value in two columns. |
| Floor | Returns the largest integer greater than or equal to the numeric value in each cell of a column. For example, if the value is 2.21, FLOOR returns 2. If the value is 5.88, FLOOR returns 5. Likewise, if the value is -5.15, FLOOR returns -6. |
| Log | Returns the logarithm of each value in a column. |
| Modulo | Returns the remainder when dividing each value in the column by a positive decimal or returns the remainder when dividing each value in two columns. |
| Multiply | Multiplies each value in the column by a positive or negative decimal or multiplies each value in two columns. |
| Natural Log | Returns the natural logarithm of each value in a column. |
| Power of | Raises the column value to the specified power of value. |
| Random | Generates random, unpredictable Double values in a specified column. |
| Round | Rounds each value in a column. |
| Sin | Returns the sin for each value in a column. |
| Square | Raises each value in the column to the power of 2. |
| Square root | Returns the square root of each value in a column. |
| Substract | Subtracts a positive or negative decimal to each value in the column. |
| Tan | Returns the tangent for each value in a column. |
Perform numeric calculations on values in two columns
To apply a numeric calculation to two columns, follow these steps:
- Go to the Wrangler workspace in Cloud Data Fusion.
- On theData tab, select the checkbox by two column names.
- Go to a column name and click thearrow_drop_downexpander arrow.
- SelectCalculate and select an option—for example,Add.
- Optional: to create a new column for the calculated values, select theCopy to a new column checkbox. Otherwise, the calculated values overrideexisting values.
- ClickApply.
The values change based on the calculation. Wrangler adds the correspondingdirective as a step in the recipe. For example, if you add the values in each rowof theQ1_Sales andQ2_Sales columns and create a new column calledH1_Sales, Wrangler adds the following transformation to the recipe:
set-column :H1_Sales arithmetic:add(Q1_Sales, Q2_Sales)When you run the data pipeline, Wrangler performs the transformation and createsa new column calledH1_Sales with the total ofQ1_Sales andQ2_Sales.
Supported calculations in two columns
You can perform the following numeric calculations on values in each row in twocolumns:
| Function | Description |
|---|---|
| Add | Adds a positive or negative decimal to a column or adds multiple columns to output the sum of each row. |
| Average | Returns the average of each row in multiple columns. |
| Divide | Divides each value in the column by a positive or negative decimal or divides each value in two columns. |
| Equal | Boolean function that compares two columns to see if values match, row by row. Returnstrue orfalse. |
| LCM | Returns the least common multiple of each number in two columns. |
| Max | Returns the maximum value for each row in two columns. |
| Min | Returns the minimum value for each row in two columns. |
| Modulo | Returns the remainder when dividing each value in the column by a positive decimal or returns the remainder when dividing each value in two columns. |
| Multiply | Multiplies each value in the column by a positive or negative decimal or multiplies each value in two columns. |
| Subtract | Subtracts a positive or negative decimal to each value in the column. |
Perform numeric calculations on values in three or more columns
Cloud Data Fusion supports performing numeric calculations on values inthree or more columns in version 6.8.0 and later.
To apply a numeric calculation to three or more columns, follow these steps:
- Go to the Wrangler workspace in Cloud Data Fusion.
- On theData tab, select the checkbox by two column names.
- Go to a column name and click thearrow_drop_downexpander arrow.
- SelectCalculate and select an option—for example,Add.
- Optional: to create a new column for the calculated values, select theCopy to a new column checkbox. Otherwise, the calculated values overrideexisting values.
- ClickApply.
The values change based on the calculation. Wrangler adds the correspondingdirective as a step in the recipe. For example, if you add the values in each rowof theQ1_Sales,Q2_Sales,Q3_Sales, andQ4_Sales columns and create anew column called2022_Sales, Wrangler adds the following transformation tothe recipe:
set-column :2022_Sales arithmetic:add(Q1_Sales, Q2_Sales, Q3_Sales, Q4_Sales)When you run the data pipeline, Wrangler performs the transformation and createsa new column called2022_Sales with the total ofQ1_Sales,Q2_Sales,Q3_Sales, andQ4_Sales.
Supported calculations in three or more columns
You can perform the following calculations on values in each row in three ormore columns:
| Function | Description |
|---|---|
| Add | Adds a positive or negative decimal to a column or adds multiple columns to output the sum of each row. |
| Average | Returns the average of each row in multiple columns. |
| Equal | Boolean function that compares two columns to see if values match, row by row. Returnstrue orfalse. |
| Max | Returns the maximum value for each row in two columns. |
| Min | Returns the minimum value for each row in two columns. |
| Multiply | Multiplies each value in the column by a positive or negative decimal or multiplies each value in two columns. |
What's next
- Learn more aboutWrangler directives.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.