The ABS function returns the absolute value of a numeric expression, converting negative values into their positive equivalent while leaving positive values unchanged.
Absolute values are useful when the direction of a difference is not important and only the size of the difference matters.
Calculate the absolute difference between expected and actual sales.
SELECT
EmployeeName,
ABS(TargetSales - ActualSales) AS SalesVariance
FROM EmployeeSales;
ABS is commonly used in variance analysis, financial reporting, reconciliation, error analysis, and performance measurement.
- ABS returns an absolute value.
- Negative values become positive.
- Positive values remain unchanged.
- Zero remains zero.
- It is useful for variance calculations.
What does ABS do?
ABS returns the absolute value of a numeric expression.
Where is ABS commonly used?
ABS is commonly used for variance, difference, reconciliation, and error calculations.