The SSIS ABS function is a mathematical function that returns the absolute positive value of the specified number or numeric expression. This article explains how to use the ABS function with an example, and the syntax for finding the absolute positive value is as shown below.
ABS(<<numeric_expression>>)
To demonstrate the ABS function, we use the Product table below, which has 14 records.
SSIS ABS function to find Absolute Positive Value
For this ABS example, add a Data Flow Task and double-click on it to enter the Data Flow region. Next, add the OLE DB Source to read data from the above SQL database product table. Please join the OLE DB Source to Derived Column because it helps to write ABS expressions and create new columns.
Next, double-click on it to open the Derived Column Transformation Editor. Drag and drop the SSIS ABS function to the row cell under the Expression and replace the numeric_expression with the Grade to return the absolute positive values. Either you can manually delete the complete <<numeric_expression>> expression or drag and drop the Grade column automatically to replace it.
The below expression shows the actual result of subtracting the product standard cost from the sales amount. Please refer to the Derived Column Transformation, Union All Transformation, Built-in Functions, and SQL Server articles in SSIS.
[SalesAmount] - [StandardCost]
The below SSIS ABS function shows the absolute positive values of the subtraction. It converts a negative to a positive sign.
ABS( [SalesAmount] - [StandardCost] )
There are some negative values in the Grade column, and the below ABS function expression converts them and returns the positive values.
ABS( [Grade] )
Click OK to close the Editor window.
Drag and drop the Union All Transformation and connect the Derived Column to it. Next, right-click on the connection node and choose the Enable Data Viewer. Please run the SSIS ABS package to see the absolute positive values of the Grade column and the arithmetic subtraction of sales profit.