ABS DAX Function (Math and Trig)
Returns the absolute value of a number.
Syntax
Parameter | Attributes | Description |
---|---|---|
Number |
The number for which you want the absolute value. |
Return values
Remarks
The absolute value of a number with the same data type and without its sign.
It also works with positive and negative infinite numbers.
Examples
-- ABS returns the absolute value of a number -- SIGN returns: -- +1 if the number is positive -- 0 if the number is zero -- -1 if the number is negative DEFINE VAR Vals = GENERATESERIES ( -2, +2, 0.5 ) EVALUATE ADDCOLUMNS ( Vals, "ABS", ABS ( [Value] ), "SIGN", SIGN ( [Value] ) ) ORDER BY [Value] DESC
Value | ABS | SIGN |
---|---|---|
2.00 | 2.00 | 1 |
1.50 | 1.50 | 1 |
1.00 | 1.00 | 1 |
0.50 | 0.50 | 1 |
0.00 | 0.00 | 0 |
-0.50 | 0.50 | -1 |
-1.00 | 1.00 | -1 |
-1.50 | 1.50 | -1 |
-2.00 | 2.00 | -1 |
Related articles
Learn more about ABS in the following articles:
-
Using scatterplots to find details in reports
This article describes how you can use a scatterplot visual to make more effective Power BI reports. » Read more
-
Using EXPAND and COLLAPSE in visual calculations
This article provides examples of visual calculations where the use of EXPAND and COLLAPSE is required to obtain the correct result. » Read more
Last update: Oct 3, 2024 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber
Microsoft documentation: https://docs.microsoft.com/en-us/dax/abs-function-dax